However, the relief is handling exceptions in any language, the rule is to always use exceptions to check for exceptional ones.
What do I mean, if your algorithm needs type checking during normal operation, then it is better to check typing explicitly using the condition, if type checking is performed to detect abnormal work, it is better to raise / handle an exception.
Although, since Javascript is free to type in, most typing problems won't throw an exception, but instead work in a way that you don't always expect ...
source share