Proposal: anaphoric if and while syntax

Jordan Harband ljharb at gmail.com
Wed Sep 14 23:36:54 UTC 2016


For what it's worth, that specific use case would be addressed by
https://github.com/tc39/String.prototype.matchAll ;-)

On Wed, Sep 14, 2016 at 4:20 PM, Oriol Bugzilla <oriol-bugzilla at hotmail.com>
wrote:

> I like this proposal. Specially for `while` loops.
>
> When I want to iterate all matches of a global regex, I always think the
> variable declaration at the top seems ugly
>
> ```js
> let match;
> while (match = regex.exec(string)) {
>   // ...
> }
> ```
>
> This looks better:
>
> ```js
> while (let match = regex.exec(string)) {
>   // ...
> }
> ```
>
> _______________________________________________
> 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/20160914/add81653/attachment-0008.html>


More information about the es-discuss mailing list