const markMiller = {
firstname: 'Mark',
secondName: 'Miller',
mass: 78,
height: 1.69,
calcbmi: function () {
this.bmi = this.mass / this.height ** 2;
return this.bmi;
},
};
const johnSmith = {
firstname: 'john',
secondName: 'Smith',
mass: 92,
height: 1.95,
calcbmi: function () {
this.bmi = this.mass / this.height ** 2;
return this.bmi;
},
};
console.log(typeof (johnSmith.bmi))
console.log(markMiller);
Why bmi
is added as attribute and show as undefined
?
I also tried to add the attribute with '[]' notation but the result was same.