+ 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
2 Answers
+ 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.
0
console.log (a[0] == b [0]) would be true