I got the result at the console when calling the function with 'calculator', but it is showing undefined when using the 'this' keyword
const calculator = {
calcBMI: function (mass, height) {
const BMI = mass / height ** 2;
return BMI;
},
firstName: "Arvind",
};
console.log(calculator.calcBMI(6, 1.8));
console.log(this.calcBMI(6, 1.8));