MonkeyOnARock MonkeyOnARock - 1 year ago 38
Javascript Question

How to add a number variable to an object in a different variable

var count = 0;
var price = req.body.price + count;

In the above example I want the variable price to be equal to req.body.price0. How can I do that?


I think

var price = req.body['price' + count];

should do the job

See also here for more information about that