Question · JavaScript and TypeScript course · Module 5: Advanced JavaScript

The instanceof Operator with Errors

What is the instanceof operator used for in error handling?

Answer options

  • To check if a caught error is of a specific type (class)
  • To create new error instances
  • To convert strings to Error objects
  • To serialize errors to JSON

You can check the correct answer by solving this task in the CodeWorlds game.