HTML DOMException code property
The code property of the DOMException interface returns a short number that contains the error code of the exception error, or 0 if none match. This is a read-only property.
var codeNumber = domException.code;
Return Value: This property returns a short number.
Example: In this example, we will create an INVALID_CHARACTER_ERR and then show its code.
Before Button Click:
After Button Click:
- Google Chrome