Answers for "Objects cannot be compared:"

10

Javascript compare two objects

var person1={first_name:"bob"};
var person2 = {first_name:"bob"}; 

//compare the two object
if(JSON.stringify(person1) === JSON.stringify(person2)){
    //objects are the same
}
Posted by: Guest on July-25-2019
0

Objects cannot be compared:

var x = new String("John");             

var y = new String("John");


// (x == y) is false because x and y are objects
Posted by: Guest on April-22-2021
0

Objects cannot be compared:

var x = new String("John");             

var y = new String("John");


// (x === y) is false because x and y are objects
Posted by: Guest on April-22-2021

Code answers related to "Objects cannot be compared:"

Browse Popular Code Answers by Language