improve error handling of isDivisible

This commit is contained in:
Masahiko Shin
2021-05-23 17:44:15 +09:00
parent 4dc0be89c3
commit a14da3d113

View File

@ -2,7 +2,7 @@
export const isDivisible = (num1, num2) => {
if (!Number.isFinite(num1) || !Number.isFinite(num2)) {
throw new Error('All parameters have to be numbers')
throw new TypeError("Expected a number")
}
if (num2 === 0) {
return false