Don't compare two arrays with ===

August 08, 2017

So, if you want to check if two arrays are equal, you might want

[]===[]

// or

[1,2,3]===[1,2,3]

Well, by that you would probably assume two trues come back, but actually, you are going to get false and false.

so, better use join() so you can compare strings.


Tagged withjavascript, array

Questions, Comments, Suggestions? Open an Issue