Small Proposal "!in"
andyearnshaw at gmail.com
Thu Jul 19 14:17:06 UTC 2018
On Thu, 19 Jul 2018 at 14:48 Mike Samuel <mikesamuel at gmail.com> wrote:
> On Thu, Jul 19, 2018 at 9:26 AM Michael Theriot <
> michael.lee.theriot at gmail.com> wrote:
>> > 'string' === typeof document.createElement('input').type
>> > // true
>> It should be noted this is a "loose check"; it does not determine whether
>> or not the property exists when its value equals undefined. It also
>> triggers getters, whereas `in` reports whether or not the property exists
>> without triggering a getter.
> Good point. `in` does trigger "has" proxy handlers though, so neither is
> side-effect free.
Except I'd argue this is a desirable side effect in the case of `in` and
less so in the case of a getter. Getters are more likely to be an
intensive operation (for example, innerHTML) than a proxy `has` operation
generally overriding the expected behaviour of the target object.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss