>for (let [index, value] of [1, 2, 3].entries())
console.log(index + ": " + value)
I still think most people will write:
```
for (let value of values) { ... }
```
and then rewrite the whole expression inside the `for-loop` when they find
out that they need the index too:
```
for (let [index, value] of [1, 2, 3].entries())
console.log(index + ": " + value)
```
`for (let value, index of values) { ... }` is still much easier to type
than `for (let [index, value] of [1, 2, 3].entries())` and also more
readable.
Also, doesn't that makes a copy of the `[1, 2, 3]`?
--
Sincerely,
Tingan Ho
@tingan87 <https://twitter.com/tingan87>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss