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);