JS Built-ins
ErrortoStringbeginner

Error.toString() β€” includes name and message

πŸ“– Usage Example
const e = new Error('fail')
`${e}`  // β†’ 'Error: fail'

Template literals implicitly call toString() on the interpolated error.

Error.toString() Contains Both

The string representation includes both the error name and the message.

Challenge: Verify that toString() contains both.

πŸ’‘ Hints (1)
  • β€’ The format is "Name: message".