+ 1

Please help in explaining this JavaScript code.I am able to understand this code and how it is returning false in both cases

Please see this and explain in detail that why it is returning false in both cases. https://code.sololearn.com/WGQ1H0052YXK/?ref=app

14th Jul 2019, 6:16 AM
Ashish
Ashish - avatar
2 ответов
+ 2
Well, first case is obvious : a string and a list are very different! Second case is a little bit more subtle : when you compare array, you compare in fact the underlying pointers. Which obviously aren't equal.
14th Jul 2019, 8:36 AM
Drax
Drax - avatar
0
console.log (a[0] == b [0]) would be true
14th Jul 2019, 9:04 AM
Jason Kennedy