I am taking the PluralSight course for ES6 Rapid Learning. And I came down to object-literal extensions in ES6. So in the video it is said that the outcome of the below code will NOT refer to the price in the productView object. Yet my Chrome console shows 150
, not 12
.
If someone can explain this, I will be very thankful.
'use strict';
let price = 6.00,
quantity = 2;
let productView = {
price: 15,
quantity: 10,
calculateValue() {
return this.price * this.quantity;
}
};
console.log(productView.calculateValue());