Using IsCallable Operation?
Allen.Wirfs-Brock at microsoft.com
Fri Jun 5 13:39:01 PDT 2009
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.
Of course it may take a while for browser implementations to respond to this change.
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Garrett Smith
>Sent: Friday, June 05, 2009 1:31 PM
>Subject: Using IsCallable Operation?
>There seems to be a lot of controversy on how to properly check if
>something should be callable. There isn't any way to determine that in
>The internal IsCallable determines if an object has a [[Call]] property.
>Will that be available as a language feature, not internal?
> Object.isCallable( document.images );
>- would provide a check to internal IsCallable and return the result.
>es-discuss mailing list
>es-discuss at mozilla.org
More information about the es-discuss