In javascript whenever I compare two similar objects it returns a false on the other hand comparison of two similar arrays retur | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In javascript whenever I compare two similar objects it returns a false on the other hand comparison of two similar arrays retur

19th Aug 2018, 1:48 PM
Raghunath
Raghunath - avatar
2 Answers
+ 3
How exactly are you comparing the objects? I believe this can help: https://www.sololearn.com/learn/JavaScript/1132/
19th Aug 2018, 1:51 PM
Eduardo Petry
Eduardo Petry - avatar
+ 1
Use if(JSON.stringify(obj1)===JSON.stringify(obj2)) alert("Similar objects);
19th Aug 2018, 3:35 PM
Calviղ
Calviղ - avatar