JS Built-ins
ErrortoStringbeginner

Error.toString() β€” typeof result is string

πŸ“– Usage Example
new Error('x').toString() === 'Error: x'  // β†’ true

Use toString() to convert errors to a readable string for logging.

typeof Error.toString()

error.toString() always returns a string.

Challenge: Verify the type.

πŸ’‘ Hints (1)
  • β€’ toString() always returns a string.