0

Equals sign

It seems simple but i'm having a little trouble understanding what it means. One the examples is x = y does that mean y will become x?

23rd Dec 2016, 5:54 PM
Alton
Alton - avatar
5 odpowiedzi
+ 3
If you write that in the javascript codeplayground: var x = 10; var y = 25; document.write(x = y) It returns the result of 25. = is the assignment operator which gives the value of one thing to another. The course says that it makes the first variable entered (x) take on the value of the second variable (y). So in the above example (hold onto your paradox objections) the variable that previously was set to 10 (x) is now the same as the variable previously set to 25 (y).
24th Dec 2016, 9:25 PM
Taylor
Taylor - avatar
+ 2
The value of x is gonna be the value of y. They gonna have the same values
23rd Dec 2016, 6:04 PM
kallzo
kallzo - avatar
+ 2
let x=10 So if you put x+x you'll get 20
23rd Dec 2016, 6:23 PM
Elias Papachristos
Elias Papachristos - avatar
+ 2
Yes 2 things 1) Statement or expression 1) X =10 : assigning values to a variable 2) X= Y Assigning variable value to another variable. 2) Question If X = Y then do this..... Here it verifies X = Y ? then it performs the action. Hope it helps.
23rd Dec 2016, 7:08 PM
Mahes S
0
Lets say x = 10 y = 25 Document.write (x = y) or something similar
23rd Dec 2016, 6:33 PM
Alton
Alton - avatar