Correct answer :-Answer: D
With the
throw statement, we can create custom errors. With this statement, you can throw exceptions. An exception can be a
string, a
number, a
boolean or an
object. In this case, our exception is the string
'Hello world!'.
With the catch statement, we can specify what to do if an exception is thrown in the try block. An exception is thrown: the string 'Hello world!'. e is now equal to that string, which we log. This results in 'Oh an error: Hello world!'.