What is assignment operator. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

What is assignment operator.

25th Dec 2016, 11:31 PM
Vipul Aggarwal
Vipul Aggarwal - avatar
2 Answers
+ 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
3rd Jan 2017, 8:54 PM
Sandip Saha
Sandip Saha - avatar
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.
25th Dec 2016, 11:45 PM
Andreas K
Andreas K - avatar