Ranges

Jordan Harband ljharb at gmail.com
Fri Nov 4 17:40:28 UTC 2016


lol thanks, good call. too much habit typing "const" :-p s/const/let there

On Fri, Nov 4, 2016 at 10:39 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> FWIW: got bitten from same thing too ... the fact `for(const x of ...)`
> works would always mislead me to think a `for(const i; ... i++)` would too,
> even if it's completely different meaning/issue/matter.
>
> Oh well
>
> On Fri, Nov 4, 2016 at 5:34 PM, Mathias Bynens <mathias at qiwi.be> wrote:
>
>> On Fri, Nov 4, 2016 at 6:24 PM, Jordan Harband <ljharb at gmail.com> wrote:
>> > Here you go:
>> >
>> > 1) `function* range(start, end) { for (const i = +start; i < end; ++i) {
>> > yield i; } }`
>>
>> For future reference: `++i` throws when `i` is a `const` binding. The
>> intended example uses `let` instead.
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161104/16b64c5d/attachment.html>


More information about the es-discuss mailing list