JavaScript does not guarantee the order of keys.
If they are entered in the same order, this approach would work most of the time, but it would not be reliable.
Also, it would return false for objects that were deeply equal, but whose keys were entered in a different order:
JSON.stringify({ a: 1, b: 2}) === "{"a":1,"b":2}"
JSON.stringify({ b: 2, a: 1}) === "{"b":2,"a":1}"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…