Created
February 12, 2020 21:42
-
-
Save willwalker753/77402a2c0c470a42c3356698e8d2407d to your computer and use it in GitHub Desktop.
Is divisible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isDivisible(dividend, divisor) { | |
let rem = dividend % divisor; | |
let divisible = false; | |
if (rem === 0) { | |
divisible = true; | |
} | |
return divisible; | |
} | |
let dividend = 18; | |
let divisor = 3; | |
console.log(isDivisible(dividend, divisor)); | |
function testIsDivisible() { | |
if (isDivisible(10, 2) && !isDivisible(11, 2)) { | |
console.log('SUCCESS: `isDivisible` is working'); | |
} else { | |
console.log('FAILURE: `isDivisible` is not working'); | |
} | |
} | |
testIsDivisible(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment