Javascript try catch statement

Introduction

Using a Try...Catch Block

try/*w  w  w .  ja v a2  s.  c o  m*/
{
   // Generate an error.
   allert("Display a message");
}
catch(Err)
{
   // Write the error information on screen.
   console.log("<p>The Error Type is: " + Err.name + "</p>");
   console.log("<p>The Error Message is: " + Err.message + "</p>");
}



PreviousNext

Related