Using try and catch

The button calls a function that has a misspelled alert.



Using throw

Call a function with varying number of arguments and when the errors occur then throw an error object that a catch block will process.

The function expects a single argument that is a number.