2080 12

BIT251 ยท 2080 ยท 5 marks

How exception handling is done in JavaScript? Write a JavaScript program that will handle an exception when an input number is divided by zero.

How exception handling is done in JavaScript? Write a JavaScript program that will handle an exception when an input number is divided by zero. [5]

Web Technology IChapter 9: JavaScript Advanced FeaturesException handling try catch

Exception handling is a mechanism to handle runtime errors gracefully so that the normal flow of the program is not disrupted. JavaScript uses the try...catch...finally construct for exception handling. --- Keyword Purpose ------------------ try Wraps the code that might cause an error catch Catc...