Consider the following example:
In the example given above,
even though the code that
threw the error - () => aaaa
,
is inside the try
code block,
we still get an error.
If we want to catch the errors that occur
in schedulers like setTimeout
and setInterval
,
then we must use try...catch
inside the definition of the function
passed as argument.