TypeError
The TypeError() constructor creates a new error when an
operation could not be performed, typically (but not exclusively) when a value is not of
the expected type.
Syntax
new TypeError()
new TypeError(message)
new TypeError(message, options)
new TypeError(message, fileName)
new TypeError(message, fileName, lineNumber)
TypeError()
TypeError(message)
TypeError(message, options)
TypeError(message, fileName)
TypeError(message, fileName, lineNumber)
Note:
TypeError()can be called with or withoutnew. Both create a newTypeErrorinstance.
Parameters
messageoptional- : Human-readable description of the error
optionsoptional- : An object that has the following properties:
causeoptional- : A property indicating the specific cause of the error. When catching and re-throwing an error with a more-specific or useful error message, this property can be used to pass the original error.
- : An object that has the following properties: