JS Built-ins
Errorbeginner

Error() β€” empty message

πŸ“– Usage Example
try {
  throw new Error('fail')
} catch (e) {
  e.message  // β†’ 'fail'
}

throw new Error() is the standard way to signal exceptional situations.

Error with No Message

new Error() creates an error with an empty string .message.

Challenge: Verify the default message is an empty string.

πŸ’‘ Hints (1)
  • β€’ Without an argument, the message defaults to an empty string.