The following is based on, and inspired by, a 'stackoverflow' post by Amadan on 28 Jan 2015; I've re-worked it for my personal benefit and clarification then thought to share it in case it may be of some help to others when trying to get their mind around this topic.
The distinction between identifiers and variables has an equivalence as that between names and people.
Names identify people, and can also identify dogs, horses, pets, etc. Names are not people, nor are people names. Generally, it is easier to say "I am Amadan" than say "I am associated with the name Amadan", the latter is less efficient in conversation though more concise in meaning.
Hence, is Amadan a person or a name? Well, it depends on the context in which you view the question. And so it is also for variables and identifiers.
In the same way:-
Identifiers can be associated with variables; they can also be associated with labels, functions, procedures, programs, apps, classes, methods, etc. Identifiers are not variables, variables are not identifiers. So, it may be said that some arbitary variable is 'var2', which avoids the slightly 'clunky' way of saying "I'll use a variable and associate it with the identifier 'var2'".
So now, the question may occur "Can I instead generally use the terms Name and Value?". For me, No!, generally not because, to be precise, "value" introduces a third concept, and incidentally, the "contents" of a variable introduces a related fourth concept.
Maybe a good analogy for a variable would be to consider a locker box: they both have identifiers (some number/name/colour/icon) and contents (whatever is held there).
A variable is not necessarily a memory location for a value, it can be a memory location for a reference to an object, and not contain the object itself (it's kind of like putting the address of a piece of real-estate into a locker, as opposed to trying to put that piece of real estate into the locker).
So, to summarize this analogy, the locker box is the variable; the identifier is the number/name/colour/icon for the locker box; the contents is a piece of paper with an address on it; the reference is the address for the piece of real estate; the value is the piece of real estate.
Hence, if a value is small and simple enough (in programming terms, a "primitive") the value itself can be directly assigned to the variable, rather than assign the reference to that value.
For instance:-
var a = 1; // assigns a value
var b = [2, 3, 4]; // assigns a reference
var aa = a; // copy the contents of 'a' to 'aa'
var bb = b; // copy the contents of 'b' to 'bb'
the above declares four variables and 'allocates' four identifiers (a, b, aa, bb);
it also specifies numerous values (1, 2, 3, 4, the array []);
a and aa each contain a different copy of the primitive value 1;
b contains references [2], [3], [4] to some values which, in turn, for this example happen to contain the values 2, 3, 4;
bb contains a copy of the references held by aa.
So if a value that is contained in b changes, the value in bb automagically changes also:-
b.push(5);
console.log(b);
// console shows [2, 3, 4, 5]
console.log(bb);
// console shows [2, 3, 4, 5]
Functions are also values:-
function greeting(name) {
console.log("Hello, " + name);
}
the above function uses the identifier 'greeting',
it is (almost but not 100%) identical to:-
var greeting = function(name) {
console.log("Hello, " + name);
}
the above variable, associated with the identifier 'greeting'
is 'assigned' with a function;
the contents of both code blocks refer to a function - console.log();
each function itself is a value.