Lombas Lombas - 1 month ago 3x
Javascript Question

Is there a specific reason why javascript has no isEqual() native function to compare Objects?

The object1 == object2 operation checks to see if the references are the same.

A lot of times we want to check if the objects structure (properties, values and even methods) are the same. We have to implement a isEqual() function for ourselves or use an external library.

Why isn't it just added to the javascript ECMA standard, like JSON.stringify() was?

Is there a specific reason?


For what I can gather, this hasn't been implemented because objects can have very different structures and only in very simple object structures consisting of name:value like obj = {name:"value",age="anotherValue"} the isEqual(obj1,obj2) would be useful.

Although I think it should be implemented nevertheless.