Module 14: Exceptions and More On Events

CMPS 162: Introduction to Programming

Introduction

Up to this points all errors were simply printed to the console and not handled properly. JavaScript has built-in functionality to support a better way to deal with problems, which are known as exception handling. Exceptions can be generated by the JavaScript runtime or raised by the programmer using throw. The try and catch construct delineates which exceptions should be caught in which part of the code. We will also have another look at handling events in JavaScript.

Module Objectives

  • Illustrate try and catch exception handling
  • Show how to throw an exceptions
  • Explain handling events in JavaScript

Learning Resources

  • Module 14 Readings: Chapters 87 thru 89 from Myers

Learning Activities

  • Module 14 Assignment: Interactive Coding Exercises 87 thru 89

For Further Study

Leave A Reply

Your email address will not be published. Required fields are marked *