Function constants for Identity and No-op

Mark S. Miller erights at google.com
Wed Aug 10 14:00:27 UTC 2016


On Wed, Aug 10, 2016 at 4:53 AM, Andy Earnshaw <andyearnshaw at gmail.com>
wrote:

> On Wed, 10 Aug 2016 at 12:42 Michał Wadas <michalwadas at gmail.com> wrote:
>
>> Function.prototype is no-op (run Function.prototype.toString() for more
>> information)
>>
>
> That's true, but using `Function.prototype` can be confusing
>

Indeed.

> Function.prototype instanceof Function
false



> when passed to a function as a callback:
>
>     someFunc(Function.prototype);
>
> It's not immediately clear that `someFunc` is expecting a callback
> function in this case, whereas `Function.NOOP` or `() => {}` are pretty
> obvious.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160810/9beb15f1/attachment.html>


More information about the es-discuss mailing list