4 ms·
Unless I'm missing something, you cannot use forEach on a Javascript object as of now (or map, reduce, every, some and other methods that are available on Array
by VeejayRampay 12y ago
Unless I'm missing something, you cannot use forEach on a Javascript object as of now (or map, reduce, every, some and other methods that are available on Array.prototype).
The only way is to use:
for(var key in obj) {...}
As for interpolation, I indeed missed the bit about quasis. Though I really wonder why they would still use concatenation if they can interpolate... Maybe to only show one feature at a time, which I guess makes sense.
- arcosdev 12y agoYou are correct, there is no forEach, a lot of libraries implement their own, but no native version.
- SimeVidas 12y agoObject.keys(obj).forEach(function (key) { var val = obj[key]; // use key and val here });
- omaranto 12y agoI think you did miss something: the comment you replied to didn't say x.forEach(f); but rather items(x).forEach(x); which is definitely possible, you just need to implement items().