3 ms·
What is wrong with this then (not my entry): process.stdin.resume(); process.stdin.setEncoding("ascii"); process.stdin.on("data", function (input)
by ricardobeat 14y ago
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.
- dheerajrav 14y agoThere is no input. You have to print the desired result for all numbers between 1-100
- ricardobeat 14y agoReally? I just wasted 20 minutes trying to figure out whatever that boilerplate was supposed to receive :/