JS: Test Object Equality by JSON String, Ordering Problem
If you turn object into JSON string 〔see JS: JSON.stringify〕 , then compare the string, this is not reliable because object properties is not ordered.
// comparison by JSON.stringify is not reliable const x = { a: 1, b: 2 }; const y = { b: 2, a: 1 }; // reverse order console.log((JSON.stringify(x) === JSON.stringify(y)) === false);
JavaScript, Object and Inheritance
- JS: Object Tutorial
- JS: Object Overview
- JS: Object Type
- JS: Test is Object Type 🚀
- JS: Determine Type of Object
- JS: Prototype and Inheritance
- JS: Prototype Chain
- JS: Object.prototype.isPrototypeOf
- JS: Get Set Prototype
- JS: Show Prototype Chain 🚀
- JS: Create Object
- JS: Object Literal Expression
- JS: Create Object with Parent X
- JS: Prevent Adding Property
- JS: Deep Copy Object, Array 🚀
- JS: Test Object Equality 🚀
- JS: Add Method to Prototype
- JS: Object Object
- JS: Object Constructor
- JS: Object.prototype