News for hackers. Stuff that matters.
Re:ECMAScript for XML - Direct XML Syntax in ECMAScript by olliej on Wednesday June 02, 2021 @09:25PM (#27376126)
Sigh. As the person who came up with for(of) I can say that's not the reason.

for(in) existed in JS, and the semantics were never going to be changed, that wasn't something that was on the table or was ever considered.

However other languages have syntaxes like:

    for each (...)

    foreach (...)

    for ( .. : .. )
All of which would be more consistent and wouldn't require a non-reserved word be reserved in one context.

We couldn't use `foreach` or `for each` as they conflicted with e4x - one directly, the other by being sufficiently similar to not be plausible.

More depressingly for(:) was killed because of the zombie "typed JS" proposal.

There are no comments on this comment yet.