⚖️callable vs. constructable
👉 [[Call]], [[Construct]] internal methods.
constructor is a constructable function.
replit ⟩ callable vs. constructable
// Array is callable & constructable, same effect.
let arr1 = Array(3);
let arr2 = new Array(3);
let map = Map(); // Map is not callable.
// ^^^
// ⛔ TypeError: Constructor `Map` requires 'new'
let sym = new Symbol(); // Symbol is not constructable.
// ^^^
// ⛔ TypeError: `Symbol` is not a constructor
arr1, // [ , , ] (3 empthy items)
arr2, // [ , , ] (3 empthy items)
Map instanceof Function, // true
Symbol instanceof Function, // trueLast updated
Was this helpful?