Why does the regular assignment statement (say, x = 5) return the value assigned (5 in this case), while the assignment combined with a variable d
x = 5
5
That's because var x = 5; is a variable statement, not an expression.
var x = 5;
The behaviour of this statement is described in Section 12.2 of the ECMAScript Language Reference.
Evaluate VariableDeclarationList. Return (normal, empty, empty).
This is basically a void return value.
void