const e = new Error("Malformed input"); // e.name is 'Error'
e.name = "ParseError";
throw e;
// e.toString() would return 'ParseError: Malformed input'Error.prototype.name / notebook
Error.prototype.name
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.