javascript false? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

javascript false?

why is the answer to this code „false“ ? i thought it was true... 😩 var a= {value: 20); var b = {value:20); alert(a==b);

19th Feb 2020, 6:14 PM
Mylisa_beth
Mylisa_beth - avatar
5 Answers
19th Feb 2020, 6:58 PM
Gabriel Ilie
Gabriel Ilie - avatar
+ 1
The answer is false because a and b are references to two memory address where the value of objects are stored. The addresses are different so the result is false
19th Feb 2020, 6:20 PM
Gabriel Ilie
Gabriel Ilie - avatar
0
what do i have to type in order to get a true result?
19th Feb 2020, 6:51 PM
Mylisa_beth
Mylisa_beth - avatar
0
thank you so much!!! 👏
19th Feb 2020, 7:20 PM
Mylisa_beth
Mylisa_beth - avatar
0
Welcome
19th Feb 2020, 7:21 PM
Gabriel Ilie
Gabriel Ilie - avatar