Skip to content

Instantly share code, notes, and snippets.

@sairion
Created May 27, 2016 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sairion/979ccc516fdf0a9d5752e3886c3ca03f to your computer and use it in GitHub Desktop.
Save sairion/979ccc516fdf0a9d5752e3886c3ca03f to your computer and use it in GitHub Desktop.
// %
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