Error Handling

error
The error statement stops execution and passes the value of the error expression to the program running the script.

Syntax:
error [expression];

Example 1:
function Divide( x, y )
{
if( y = 0 )
error ‘The divisor should not be zero’;
return x / y;
}

var z = Divide( 8, 9 );