3 ms·
The performance is hard, but the bug-for-bug compatibility is what will kill you.
by Locke1689 11y ago
The performance is hard, but the bug-for-bug compatibility is what will kill you.
- jacquesm 11y agoYou could just leave them out ;)
- bzbarsky 11y agoActually, for JS engines this is a much smaller problem than for other parts of the web platform. There are two nasty warts I'm aware of: the "function inside if" mess, and the fact that the spec says enumeration order is undefined but actual web pages depend on some things about enumeration order that all browsers implement; chances are this will make it into the spec at some point. But by and large JS engines agree with each other and with the spec. Much more so than, say, DOM or CSS implementations.
- WorldMaker 11y agoEnumeration order was indeed (finally) added to the ES2015 spec. Here's a link to the release candidate spec for the [[OwnPropertyKeys]] algorithm: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys https://people.mozilla.org/~jorendorff/es6-draft.html#sec-or...
- bzbarsky 11y ago[[OwnPropertyKeys]] is not invoked by a for-in loop. [[Enumerate]] is instead, and while it defines that the set of iterated names is the same as that returned by [[OwnPropertyKeys]] it explicitly says that order is not defined.