js-test-1

Will we catch the error in the catch block?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Regular try/catch blocks only catch errors that appear in the synchronous code.

As the Promise in the second line doesn’t have its own asynchronous .catch block, the rejection will be left unhandled.

An UnhandledPromiseRejectionWarning will be raised and the code inside of the regular catch block will not be executed.


ANSWER: The error will not be caught and the message the error was caught! will NOT be logged to the console.