Ok I now love iterators and generators. http://Number.prototype.to = function*(n) { for (let i = +this; i <= n; i++) yield i; } for (let i of 0..to(100)) {...}
Allen, could you clarify what in particular is supposed to use %NumberPrototype% as opposed to (the modified) Number.prototype in this example?
-
-
5.a.ii https://tc39.es/ecma262/#sec-getvalue … https://tc39.es/ecma262/#sec-properties-of-number-instances … "Number prototype object" Defined https://tc39.es/ecma262/#sec-properties-of-the-number-prototype-object … Admittedly not super obvious and ES6 editorial changes unintentionally made it less clear. ES5 spec clearer in this regard
-
Isn’t it still %NumberPrototype% in the above example? The proxy in this example is not Number.prototype, it’s Number.prototype[[Prototype]] (which Get/Has/Set can hit).
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.