Skip to content

Instantly share code, notes, and snippets.

@henrahmagix
Created May 25, 2017 12:48
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 henrahmagix/80b5c051239a13a551ec983643956377 to your computer and use it in GitHub Desktop.
Save henrahmagix/80b5c051239a13a551ec983643956377 to your computer and use it in GitHub Desktop.
Is it really turtles all the way down?
'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf8');
let numberOfLevels = 0;
process.stdout.write('How many levels would you like to inspect? ');
process.stdin.on('data', function (n) {
numberOfLevels = parseInt(n, 10);
for (let i = 0; i < numberOfLevels; i++) {
console.log("It's a turtle.");
}
process.exit();
});
$: node turtles.js
How many levels would you like to inspect? 3
It's a turtle.
It's a turtle.
It's a turtle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment