Created
May 27, 2016 09:01
-
-
Save sairion/979ccc516fdf0a9d5752e3886c3ca03f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 mod(num, by) { | |
var tmp_num = num; | |
while (tmp_num - by >= 0) { | |
tmp_num -= by | |
} | |
return tmp_num; | |
} | |
function fizzbuzzMod (limit) { | |
for (var i = 1; i <= limit; i++) { | |
if (i % 15 === 0) console.log('fizzbuzz'); | |
else if (i % 3 === 0) console.log('fizz'); | |
else if (i % 5 === 0) console.log('buzz'); | |
else console.log(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment