Advertisement
Guest User

Untitled

a guest
May 27th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // %
  2. function mod(num, by) {
  3. var tmp_num = num;
  4. while (tmp_num - by >= 0) {
  5. tmp_num -= by
  6. }
  7. return tmp_num;
  8. }
  9.  
  10. function fizzbuzzMod (limit) {
  11. for (var i = 1; i <= limit; i++) {
  12. if (i % 15 === 0) console.log('fizzbuzz');
  13. else if (i % 3 === 0) console.log('fizz');
  14. else if (i % 5 === 0) console.log('buzz');
  15. else console.log(i);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement