Function constants for Identity and No-op

Michał Wadas michalwadas at
Wed Aug 10 15:55:36 UTC 2016

Function.isFunction was a joke, I'm pretty sure that only very old legacy
code deals with document.all and crazy stuff like that (however, it would
be useful, but saving me from typing few more characters isn't something
urgent or important).

On 10 Aug 2016 5:46 p.m., "Peter van der Zee" <ecma at> wrote:

> >> What's the issue with document.createElement('object')?
> > It's a callable exotic object.
> >> Function.isFunction? :D
> > typeof is what you are looking for.
> There is precedent (at least in IE [1]) for exotic functions where
> `typeof` returned "unknown". Could happen for any exotic value unless
> the spec changed on that. An `isFunction`, or rather, a simple
> `isCallable`, may not be that far off the mark and is in line with the
> existing `isArray`. Though I'd much rather have callables invariantly
> locked down to being "typeof function". Even if that means explicit
> exceptions to some legacy cases.
> - peter
> PS. Regexes in firefox were "callable" and had typeof function, but I
> think that's so far back [2] it's not super relevant here. Of course
> the same could be said about the IE case.
> [1]; one of many examples:
> [2];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list