1
const calcBMI = function (mass,height){
    return mass / height ** 2
}

const mark = {
    fullName : "Mark Smith",
    mass : 78,
    height : 1.69,
    // BMI : calcBMI(78, 1.69)
    BMI : calcBMI(this.mass,this.height)

}

I want to create a BMI property in this object. If I do it with first way which gives exact numbers it works but if I do it with second way I get a NaN for BMI. I can't understand why.

0 Answers0