>> I'm guessing that code like:
>> 
>> ```js
>> var matches = /foo/.execMultipleLazy('str')
>> for (let match of matches) {
>>  //do something
>> }
>> for (let match of matches) {
>>  //do something
>> }
>> for (let match of matches) {
>>  //do something
>> }
>> ```
>> 
>> Would go wrong somehow

> Yes.  This is a standard Python issue - if you want to make sure you
> can loop over something twice, regardless of whether it's an array or
> an iterator, just pass it through list() first.
> 
> Similarly, in JS you'd just pass it through Array.from() first.


Additional option:

```js
var arrayOfMatches = [ .../foo/.execMultipleLazy('str') ]
```

-- 
Dr. Axel Rauschmayer
a...@rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to