Skip to content

Instantly share code, notes, and snippets.

@nataliemarleny
Created June 1, 2020 12:53
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 nataliemarleny/4a706b40615d391ea9a3636d6f95b7b3 to your computer and use it in GitHub Desktop.
Save nataliemarleny/4a706b40615d391ea9a3636d6f95b7b3 to your computer and use it in GitHub Desktop.
Read input text file for completing algos (Node.js)
const fs = require('fs');
const input = fs.readFileSync(0).toString();
@nataliemarleny
Copy link
Author

const lines = input.split("\n").map((i) => parseInt(i, 10));

converts a string into an array of numbers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment