Re:Fizz Buzz codegolf challenge in 15 languages
by idlecool on Friday December 14, 2012 @12:35PM
(#4922080)
`console.log` works fine.
[ Parent
| on HN ]
Re:Fizz Buzz codegolf challenge in 15 languages
by ricardobeat on Friday December 14, 2012 @12:40PM
(#4922114)
What is wrong with this then (not my entry):
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) {
var output = ''
if (input % 3 === 0){
output += 'Fizz'
}
if (input % 5 === 0){
output += 'Buzz'
}
console.log(output || input)
});
Testing locally with for(i=1;i<=30;i++){
process.stdin.emit('data', i.toString())
}
process.stdin.destroy()
gives the correct results.
Re:Fizz Buzz codegolf challenge in 15 languages
by dheerajrav on Friday December 14, 2012 @01:17PM
(#4922307)
There is no input. You have to print the desired result for all numbers between 1-100
Re:Fizz Buzz codegolf challenge in 15 languages
by ricardobeat on Friday December 14, 2012 @01:28PM
(#4922361)
Really? I just wasted 20 minutes trying to figure out whatever that boilerplate was supposed to receive :/