Skip to content

Commit

Permalink
feat: finished conditions.js exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
HakiEBIBI committed Nov 11, 2024
1 parent 45057e5 commit 5c7fd7b
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/basics/conditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
* @return {boolean} true if n is bigger than 2
*/
export function isBiggerThan2(n) {
// Write your code here

if(isNaN(n)){
throw new Error("Passed value is not a number");
}

if (n > 2) {
return true
} else {
return false
}
}

/**
Expand All @@ -22,5 +31,16 @@ export function isBiggerThan2(n) {
* @return {boolean} true if m is a multiple of n
*/
export function isMult(n, m) {
// Write your code here
if(isNaN(n)){
throw new Error("Passed n is not a number")
} else if (isNaN(m)){
throw new Error("Passed m is not a number")
}

if (m % n && n % m === 0) {
return true
} else {
return false
}

}

0 comments on commit 5c7fd7b

Please sign in to comment.