fizzbuzz/fizzbuzz.js

14 lines
278 B
JavaScript
Raw Normal View History

2010-06-26 16:54:40 +00:00
#!/usr/bin/env node
"use strict";
var sys = require('sys');
(function () {
2010-09-13 05:03:45 +00:00
var i, msg;
2010-06-26 16:54:40 +00:00
for (i = 1; i <= 100; i += 1) {
2010-09-13 05:03:45 +00:00
msg = '';
2010-06-26 16:54:40 +00:00
2010-09-13 05:03:45 +00:00
if (0 === (i % 3)) { msg += "Fizz"; }
if (0 === (i % 5)) { msg += "Buzz"; }
if (msg.length > 0) { console.log(msg); }
2010-06-26 16:54:40 +00:00
}
}());