JavaScript assignment operator

 Lesson 5: JavaScript assignment operator



We use assignment operator to store values in a variable.

It is represented by a equal(=) sign.

var price = 25;

Whatever we have on the right hand side of the variable is evaluated first.

Thus, if we had an expression like 5 * 5 that’d be done first then the value is assigned to the left hand side.

This is called a simple assignment operator.

To make it generic, if we had x = y. The value of y would be assigned to x.

It’s common quite common to initialize the variable with a value as it is declared.



Post a Comment

0 Comments

React