Skip to content

Instantly share code, notes, and snippets.

@alessbell
Created December 31, 2018 21:54
Show Gist options
  • Save alessbell/62b8d6fe73a6379f8545f5f023880d12 to your computer and use it in GitHub Desktop.
Save alessbell/62b8d6fe73a6379f8545f5f023880d12 to your computer and use it in GitHub Desktop.
// cracklepop.js
let message;
const arr = [...Array(101).keys()];
arr.shift();
arr.forEach((num) => {
if (!(num % 3) && !(num % 5)) {
message = 'CracklePop';
} else if (!(num % 3)) {
message = 'Crackle';
} else if (!(num % 5)) {
message = 'Pop';
} else {
message = num;
}
console.log(message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment