Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created November 22, 2015 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuck0523/ff1ffbb21b92cf3e4d4e to your computer and use it in GitHub Desktop.
Save chuck0523/ff1ffbb21b92cf3e4d4e to your computer and use it in GitHub Desktop.
var lines = [];
var reader = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
reader.on('line', function(line) {
lines.push(line);
});
reader.on('close', function() {
for(var i = 0; i < lines.length; i++) {
console.log(i + ') ' + lines[i]);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment