Created
September 20, 2019 16:04
-
-
Save Harrisonkamau/9d5701cdb8e035d44a79421f9225f81b to your computer and use it in GitHub Desktop.
Testing for deep equivalence between two JavaScript arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// let's try the old way | |
const arr1 = [1,2,3]; | |
const arr2 = [1,2,3]; | |
console.log(arr1 === arr2); // returns false | |
// Hello JSON.stringify()! | |
console.log(JSON.stringify(arr1) === JSON.stringify(arr2)); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment