⚖️callable vs. constructable

  • if a function can be invoked in the form F(), it's callable.

  • if a function can be invoked in the form new F(), it's constructable.

not every function is callable, for example, Map is a function, but calling it with Map() throws a TypeError

not every function is constructable, for example, Symbol is a function, but calling it with new Symbol() throws a TypeError

functionF()new F()note

Array, Error, Function

same effect

Boolean, String, Number

primitive

wrapper object

Date

string

object

Symbol, BigInt

⛔️ TypeError

Proxy, Map

⛔️ TypeError

class

⛔️ TypeError

Last updated