Hi,
And it's called zipWithIndex in Scala:
```scala
for ((value, i) <- someTraversable.zipWithIndex) {
// do stuff
}
```
And, in Ruby, it's each_with_index:
```ruby
for value, i in someArray.each_with_index
# do stuff
end
```
I see a pattern, here. It seems several other languages are pretty fine
with a simple method that bundles elements of a collection with their
indices, and then rely on destructuring on the left-hand-side of their for
loop to extract them again, instead of adding additional syntax for this
use case. IMO, that's a strong argument for doing the same thing in ES.
Cheers,
Sébastien
I think there's something
On Tue, Jul 14, 2015 at 8:49 PM, Alexander Jones <[email protected]> wrote:
> It's called `enumerate` in Python. And it's trivial to implement:
>
> ```js
> for (let [i, value] of enumerate(someIterable)) {
> // behold...
> }
> ```
>
> On Tuesday, July 14, 2015, Domenic Denicola <[email protected]> wrote:
>
>> From: Tingan Ho [mailto:[email protected]]
>>
>> > But they aren't clean solutions to a wildly popular problem.
>>
>> I disagree.
>> _______________________________________________
>> es-discuss mailing list
>> [email protected]
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss