Determine if a value is Callable/Constructible

Domenic Denicola d at
Mon Mar 30 16:20:56 UTC 2015

From: Axel Rauschmayer [mailto:axel at] 

> In some way, that would even be correct – depending on what you expect a function to be: something callable or something constructible. Alas, there is currently no simple way to distinguish “callable” and “constructible”.

Why do you say they're not callable?

Is this function callable?

    function f() {
      throw new TypeError("cannot call f because you're not pretty enough");

what about

    function f() {
      throw new TypeError("Class constructors cannot be invoked without 'new'");


More information about the es-discuss mailing list