throw error javascriptio code example
Example 1: javascript how to raise the error
if (..condition..) {
throw 'Error message';
}
Example 2: try catch error
try {
console.log('hello');
}
catch (e){
}
if (..condition..) {
throw 'Error message';
}
try {
console.log('hello');
}
catch (e){
}