Last active
August 31, 2021 22:07
-
-
Save manila/2f37c11ea8c3481be2ac946658c0bddc to your computer and use it in GitHub Desktop.
cracklepop
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
const cracklePop = (start, end, step = 1) => { | |
let num = start | |
if (num > end) { | |
return false | |
} | |
let result = num | |
if (num % 3 == 0 && num % 5 == 0) { | |
result = 'CracklePop' | |
} else if (num % 3 == 0) { | |
result = 'Crackle' | |
} else if (num % 5 == 0) { | |
result = 'Pop' | |
} | |
console.log(result) | |
cracklePop(num + step, end, step) | |
} | |
cracklePop(1, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment