Let's take a look at https://github.com/PacktPublishing/Hands-on-JavaScript-for-Python-Developers/tree/master/chapter-9/error-object. Open the index.html file and examine the JavaScript console. The first function, typoError, is invoked and throws a wonderful error.
It should look like this:
Now, let's look at the code for our function in index.js:
const typoError = () => {
cnosole.error('my fault')
}
OK! It's a simple typo, as we've all done: it should be console.error instead of cnosole.error. If you've never made a typo in code… you're a unicorn. The error message we see in the console makes it easy to see what the error is and on what line of code it lives: line 2. Now, something interesting to note is that after calling typoError() toward the end of the file, we also have an invocation to another function but it doesn't fire. We know this because (spoiler alert) it also throws errors...