intentionally throw try catch js code example
Example 1: js throw error
throw new Error('Whoops!')
Example 2: javascript how to raise the error
if (..condition..) {
throw 'Error message';
}
throw new Error('Whoops!')
if (..condition..) {
throw 'Error message';
}