Wide view image of an Oops sign on Wooden block place over yellow background. With plenty of copy space.

Errors

Errors happen in code. We need to be able to handle them in our JavaScript code. We also may sometimes wish to throw our own errors in specific situations. Ideally we want to handle errors gracefully to provide the best end user experience we can. Suppose we have the following code…

let animal = newAnimal;
console.log(animal); 

This code will throw a reference error because newAnimal is not defined. This will bring our code to a halt, but is that really what we want to do? We can use tools like try/catch to handle errors more efficiently.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content