3 ms·
For-in array can be implemented using ES6's for-of. https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of https://developer.mozilla
by dkopi 11y ago
For-in array can be implemented using ES6's for-of.
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of https://developer.mozilla.org/en/docs/Web/JavaScript/Referen...
Also, Not sure if it would be correct to implement a python dict using an ES6 map. If the keys are all strings, probably better to stick to a JS object.
Check out the performance difference:
http://jsperf.com/es6-map-vs-object-properties/73 http://jsperf.com/es6-map-vs-object-properties/73
- azazel75 11y agoFor-of only works for iterable sources, it would not be a complete replacement of for...in, also it seems a bit slower that for...in as of now.. see https://kpdecker.github.io/six-speed/ https://kpdecker.github.io/six-speed/