Skip to content

Instantly share code, notes, and snippets.

@kevmor11
Created April 4, 2017 02:58
Show Gist options
  • Save kevmor11/8789bd6ca84495b18a19da6dbcf9de2d to your computer and use it in GitHub Desktop.
Save kevmor11/8789bd6ca84495b18a19da6dbcf9de2d to your computer and use it in GitHub Desktop.
LoopyLighthouse function
function loopyLighthouse (start, end, number1, number2, replace1, replace2) {
for (var i = start; i <= end; i++) {
if (i % number1 === 0 && i % number2 === 0) {
console.log(replace1 + replace2);
}
else if (i % number1 === 0) {
console.log(replace1);
}
else if (i % number2 === 0) {
console.log(replace2);
}
else {
console.log(i);
}
}
};
loopyLighthouse(1,20,3,4,"Loopy","Lighthouse");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment