JS Built-ins
TypeErrorbeginner

TypeError β€” instanceof check

πŸ“– Usage Example
null.toString()  // throws TypeError: Cannot read properties of null

TypeError is thrown when an operation is applied to a value of the wrong type.

TypeError Constructor

new TypeError('msg') creates a TypeError instance.

Challenge: Verify that a new TypeError is an instance of TypeError.

πŸ’‘ Hints (1)
  • β€’ Use new TypeError(message) to create a TypeError instance.