I'm going through a course and working through the example on object literal expressions, the example code given
'use strict';
var price = 5.99, quantity = 10;
var prod = { price: 7, quantity: 1,
calc() {
return this.price * this.quantity
}
};
console.log(prod.calc());
says that when run, the console should have 59.90 in it as "this" is referring to the context of the code, not the object that contains the function. When I run the code (using the latest Chrome) the console shows 7. If I remove the two "this."
return price * quantity
it returns 59.90 which is the opposite of what the video says it should be doing. Any idea where I'm going wrong with this? Thanks