mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00
improve error handling of isDivisible
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user