Replies: 1 comment 1 reply
-
The indexing operator will not go up the prototype chain, at least for now. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In ES the syntax
obj["myMethod"]
andobj.myMethod
is equivalent and both go up the prototype chain. We could increase the opportunities for tree-shaking ifobj["prop"]
was only ever looking inobj
and not inObject.getPrototypeOf(obj)
(and thus returnundefined
when notobj.hasOwnProperty("prop")
).In ES tree-shaking typically does not involve methods (due to the problem above).
I can't see this being a problem for any realistic DeviceScript code but it may be a bit surprising.
Beta Was this translation helpful? Give feedback.
All reactions