Using IsCallable Operation?
Mark S. Miller
erights at google.com
Fri Jun 5 14:18:58 PDT 2009
On Fri, Jun 5, 2009 at 1:39 PM, Allen Wirfs-Brock
<Allen.Wirfs-Brock at microsoft.com> wrote:
> Not in ES5. Generally checking that typeof x === 'function' is a close approximation. ES5 (11.4.3) requires that both native (ie, pure actual ECMAScript objects) and host objects that implement [[Call]] produce "function" when typeof is applied to them. This is a change from ES3 that did not impose this requirement upon host object objects.
Why is this an approximation? In ES5, how can
typeof x === 'function'
differ from testing whether something is callable?
More information about the es-discuss