Let's say I have a function that accepts only non-negative numbers and I receive a negative argument.
In Python, I would raise a ValueError
. In Java, I would throw an IllegalArgumentException
. Is there any built-in exception I should throw in JavaScript, or should I return undefined
?