Is there a way to loop through an array (or something similar) when generating js code? For example, I have this in mongoose:
users.updateOne({'_id': req.user._id}
, {
["local.minMinutes"]: req.body.minMinutes
, ["local.color1U"]: req.body.color1U
, ["local.color2U"]: req.body.color2U
, ["local.color3U"]: req.body.color3U
, ["local.color4U"]: req.body.color4U
, ["local.color5U"]: req.body.color5U
});
I'd like to be able to say "loop through 1 to 5" instead of having to write each individual number out, but a for() loop inside the mongoose call is giving all sorts of error. I hope this question is specific enough - thank you!
map-type methods?