var numbers = [1, 5, 10, 15];
var doubles = numbers.map(function(x) {
return x * 2;
//doubles is now [2, 10, 20, 30]
I am following this above example, This is working for a constant 2, how can I mulitply the elements with variable this.price
,
var numbers = [1, 5, 10, 15];
var doubles = numbers.map(function(x) {
return x * this.price;
How can I make this works? this.price
is a public variable.