DEV Community

Discussion on: How to compare two arrays in javascript?

 
stereobooster profile image
stereobooster

JSON.stringify([undefined]) === JSON.stringify([null])

Thread Thread
 
joshinat0r profile image
joshinat0r

It's just creating two JSON strings and compares them, all of JSONs limitations (not only undefined or null but also Infinite, NaN, functions, symbols and such) apply. Shouldn't have to mention it as should be fairly obvious.