What is the point of a catch statement? - building an fcc leaderboard - Step 5

It says it is used to catch errors, but isn’t that what the console is for? How helpful is the catch statement?

And now we are adding a try block, so how does it figure out what is a potential error?

Challenge Information:

Learn Asynchronous Programming by Building an fCC Forum Leaderboard - Step 5

At most console.log or console.error can print the error, it will not stop it. catch allows
to prevent error from crashing application, and gives ability to decide what to do when error is encountered. Printing to console is just one of possible choices.

Errors can be thrown with the throw statement.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.