Languages

What is the best way to compare two objects in javascript?

14 points
Asked by:
Marcin
15680

I whould like to compare two objects in javascript but it it doesn't work.

// ONLINE-RUNNER:browser;

var val_1 = {
  name: 'test',
  age: 25
};

var val_2 = {
  name: 'test',
  age: 25
};

console.log(val_1 == val_2)

What I am doing wrong?

0 answers
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join