3 ms·
I suppose you could use the first example with Object.keys ... var keys = Object.keys(myObj); for (var i = 0; i < keys.length; i++) { myObj[keys[i]]; }
by joewrong 12y ago
I suppose you could use the first example with Object.keys ...
var keys = Object.keys(myObj);
for (var i = 0; i < keys.length; i++) {
myObj[keys[i]];
}
- torkable 12y agoObject.keys is incredibly slow and you should never use it, for in loops are far quicker.