-
-
Save ArupSen/8903276 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// challenge description | |
// sample input - | |
// sample output - | |
function coolFunction (input) { | |
var dataStruct = []; // or {} | |
var output = ""; // or 0 | |
dataStruct = input.split(','); | |
output = dataStruct.join(' '); | |
return output; | |
} | |
var fs = require("fs"); | |
fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) { | |
if (line !== "") { // ignore empty lines | |
console.log(coolFunction(line)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I started off using the editor on the codeEval site but I seem to use the same basic pattern and workflow for each challenge. I use the Chrome console to hack and try stuff out. I copy / paste the function that I write in my text editor (TextMate). The pattern is typically breaking each line into an array or object which I then iterate. It uses less memory if I didn't have a function call but the way I've been doing it works well for me. Last year it would have been Python, this year (2014) it's js.