4 ms·
How do you get javascript to work? I tried `process.stdout.write`, `console.log`, but the score is always zero. Other issues: - The "Solve FizzBuzz" button do
by ricardobeat 14y ago
How do you get javascript to work? I tried `process.stdout.write`, `console.log`, but the score is always zero.
Other issues:
- The "Solve FizzBuzz" button doesn't go anywhere if you are logged in, neither does "The Scenario" up top.
- Forum doesn't work (please fill in all the required fields - they already are)
- Signout link doesn't work
- ddrmaxgt37 14y agoI'm wondering the same thing...
- idlecool 14y ago`console.log` works fine.
- ricardobeat 14y agoWhat 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 :/
- dheerajrav 14y agoprocess.stdin.resume(); process.stdin.setEncoding('ascii'); process.stdin.on('data', function (input) { numbers = input.split("\n"); sum = parseInt(numbers[0]) + parseInt(numbers[1]) process.stdout.write(sum+"\n"); }); this is a sample code that takes a two digit integer and prints its sum. Can you use this format and see if it works?
- deleted 14y ago[deleted]