Languages

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

14 points
Asked by:
jarlh
325

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
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join