Assignments right to left JavaScript

Assignments right to left JavaScript
0

#1

In one of the lessons it says: “Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.”

Can someone explain me this in another way, I don’t think I get it like it is stated.

Thanks in advance for the help!!


#2

That means that
example = 1 + 2;
is evaluated as
example = (1 + 2);
instead of
(example = 1) + 2;


#3

Like @ArielLeslie shows above, you could also think of it in terms of calculations are peformed/evaluated/resolved on the right side before being assigned to the example variable on the left side.

1 + 2 is resolved/evaluated/calculated to be 3 and then 3 is assigned to the variable called example.