JS Built-ins
Errorbeginner

Error types β€” TypeError extends Error

πŸ“– Usage Example
new TypeError('bad arg')    // wrong type
new RangeError('out of bounds') // out of range

JavaScript has several built-in Error subtypes for different error categories.

TypeError instanceof Error

TypeError is a subclass of Error, so new TypeError() instanceof Error is true.

Challenge: Verify the instanceof chain.

πŸ’‘ Hints (1)
  • β€’ All built-in error types extend the base Error class.