how to though exception in javascript code example
Example 1: javascript how to raise the error
if (..condition..) {
throw 'Error message';
}
Example 2: how to raise exception in js
throw new Error('Exception message');
if (..condition..) {
throw 'Error message';
}
throw new Error('Exception message');