Determine if a value is Callable/Constructible

Caitlin Potter caitpotter88 at
Mon Mar 30 16:33:22 UTC 2015

>On Mar 30, 2015, at 12:20 PM, Domenic Denicola <d at> wrote:
>Why do you say they're not callable?
>Is this function callable?
>   function f() {
>     throw new TypeError(“f immediately throws");
>   }

I think there’s a distinction here.

`function f() {}` might throw when called, but that’s in the author of the function’s control.

`class C {}` will always throw when called (in the current draft), so you can’t “really” consider it callable. No user-authored code is invoked when [[Call]]-ing a class constructor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list