更新时间:2023-11-29 12:02:10
一个简单的解决方案是对对象进行JSON字符串化并比较它们的字符串表示形式.正如@Jan所说的...
A simple solution would be to JSON stringify the objects and compare their string representations. As @Jan mentions ...
这仅在对象以完全相同的方式初始化时才有效 道路.如果属性相同但顺序不同,它将 失败
this will only work if the objects are initialized in the exact same way. If the properties are the same but in a different order, it will fail
...这有点脆弱,但可能适合您的目的.
...this is a bit brittle but may suit your purposes.