user defined exceptions in js

JavaScript
throw new Error('Exception message');
Source

Also in JavaScript: