+ 1
How would you compare 2 objects in JavaScript?
5 Answers
+ 5
https://code.sololearn.com/WeCZ41sKPLj5/?ref=app
This code can compare your two manual object
+ 5
@James
:)
:)
:)
:(
:(
:(
:(
:(
It's not working with function anonymous :(
0
What do you mean by "compare" exactly?
0
@Very Hard
The JSON.stringify() method is perfect!
- 1
Well, you can compare them using the method typeOf, which returns the type of the objects and simply use if equal (==), distinct (!=), identical, (===) or not identical (!==).
An object is identical to other if its type AND value of its attributes are exactly equal.