logo
logo

Throw Custom Error

Beginner

Throw Custom Error

Create a function called
divideNumbers
that takes in two numbers and returns their quotient. If the second number is 0, throw a custom error object with the properties
name
set to
'DivideByZero'
and
message
set to
'Cannot divide by zero'
.
Console
Submit
Solution
00:00