divied功能加入錯誤判斷
This commit is contained in:
parent
c39c6f3bef
commit
c5fe0f5268
@ -12,6 +12,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function divide(a, b) {
|
function divide(a, b) {
|
||||||
|
if(b <= 0) {
|
||||||
|
throw 'b must be greater than0'
|
||||||
|
}
|
||||||
return a/b;
|
return a/b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user