Why is the output b? JS challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
3rd May 2021, 6:48 AM
Kamrul Hasan Raza
3 Answers
+ 6
When you use new, you explicitly express your desire to work with object. It's simple: compared are not the objects' insides, but the objects' references. And they, of course, are not equal, as two different objects were created. Thanks and happy coding
3rd May 2021, 7:12 AM
Matias
Matias - avatar
+ 2
Because a and b are 2 different string object.
3rd May 2021, 7:17 AM
TOLUENE
TOLUENE - avatar
0
let a = "hello" let b = "hello"
3rd May 2021, 7:19 AM
VuxxLong
VuxxLong - avatar