This works for me. Compare with your calls to areEqual and areSame. What is different ? Then why isn’t it working ?
If you observe it you’ll understand.
let productdisplay = new Surfexcel(33, 'a');
let productdisplay1 = new Surfexcel(33, 'a');
console.log(areEqual(productdisplay,productdisplay1));
console.log(areSame(productdisplay, productdisplay1));
function Surfexcel(age, name) {
this.age = age;
this.name = name;
}
function areEqual(productdisplay, productdisplay1) {
return productdisplay1.age === productdisplay.age && productdisplay1.name === productdisplay.name;
}
function areSame(productdisplay, productdisplay1) {
return productdisplay1 === productdisplay;
}