Created
April 4, 2017 02:58
-
-
Save kevmor11/8789bd6ca84495b18a19da6dbcf9de2d to your computer and use it in GitHub Desktop.
LoopyLighthouse function
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 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