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!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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 Antworten
+ 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