ECMAScript quiz: which method from Array.prototype can cause getter invocations on Array.prototype when used on a normal array?
-
-
Replying to @tehjh
concat copyWithin every filter find findIndex forEach includes indexOf join lastIndexOf map pop reduce[Right] reverse shift slice etc
1 reply 0 retweets 0 likes -
Replying to @awbjs
most of these only trigger because of the lookup of the function itself though
2 replies 0 retweets 0 likes -
Replying to @tehjh
nope, look at the spec. Any Get() abstract operation can trigger a getter https://tc39.github.io/ecma262/#sec-properties-of-the-array-prototype-object …
1 reply 0 retweets 0 likes -
Replying to @awbjs
but only if the property doesn't exist on the array already; so e.g. [1].pop() doesn't invoke getters on Array.prototype
1 reply 0 retweets 0 likes -
Replying to @tehjh
array instances can be sparse so any Get() potentially goes to the prototype
1 reply 0 retweets 1 like
oooh, good point. I always thought they had explicit undefined values... thanks for that :)
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.