Skip to content

Instantly share code, notes, and snippets.

@manila
Last active August 31, 2021 22:07
Show Gist options
  • Save manila/2f37c11ea8c3481be2ac946658c0bddc to your computer and use it in GitHub Desktop.
Save manila/2f37c11ea8c3481be2ac946658c0bddc to your computer and use it in GitHub Desktop.
cracklepop
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