In JavaScript, an error is
represented by an object.
The object contains two properties:
When an error is caught inside a try
block,
the catch
block gets executed.
We can access the error object
inside the catch
block
as shown in the example given below.
In the example given above,
the error
variable stores the error object.