I made a mistake with writing the methods. But it still works and is way shorter is it allowed to write it like this?
var Mark = {
firstName: 'Mark',
lastName: 'Wielstra',
mass: 78,
height: 1.69,
calculateBMI() {
this.bmi = this.mass / (this.height * this.height);
return this.bmi;
}
}
Instead of this:
var Mark = {
firstName: 'Mark',
lastName: 'Wielstra',
mass: 78,
height: 1.69,
calculateBMI: function() {
this.bmi = this.mass / (this.height * this.height);
return this.bmi;
}
}