const users = [
{name:'John',age:24},
{name:'Victor',age:28}
];
const newUser = JSON.parse(JSON.stringify(users));
console.log(users);
console.log(newUser);
console.log(typeof(users));
console.log(typeof(newUser));
console.log(users==newUser)
OUTPUT:
[ { name: 'John', age: 24 }, { name: 'Victor', age: 28 } ]
[ { name: 'John', age: 24 }, { name: 'Victor', age: 28 } ]
object
object
false
object users
and newUser
have exactly same items and values.
They why users==newUser
is false?