- 4
What is assignment operator.
2 ответов
+ 2
You also May think like this, a variable is a container, and = (equal to) or assignment operator is nothing but giving something (vale, string..) to the container to store.
and whenever next time we use the variable or container name we are referring the value stored in it.
don't treat it just like an equal to sign, otherwise, you may get confused when you will face something like:
x=x+1 and you come to the result after canceling x from the both sides 1=0
0
The assignment operator assigns a value to a variable (symbol).
Its equal to the mathematical way to say x is equal to 5 (x=5)
var x = 5; means in JS that you give x the value of 5. After this 2*a will be 10.