Evaluate prefix after assignment

Rick Waldron waldron.rick at gmail.com
Tue May 12 19:08:19 UTC 2015

On Tue, May 12, 2015 at 1:58 PM Emanuel Allen <emanuelallen at hotmail.com>

> Is this the same across browsers:
> var i = 0, arr = 'a','b','c'], e,
> obj = {a:{name:'a'}, b:{name:'b'},c:{name:'c'}};
> while ((e=arr[i])&&(arr[i++]=obj[e]));
> //output:
> >arr
> >[{name:'a'},{name:'b'},{name:'c'}]


> I'm worrying about the "i++"...

Worried about what, exactly?

Your subject says "prefix", but this is the postfix operator.

> I test it out in node's repl... V8... Should the language it self be the
> same across browsers in situation like this?

Yes, absolutely. It's explicitly described in the spec (and has been for a
very long time).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150512/14be5145/attachment.html>

More information about the es-discuss mailing list