Created
May 25, 2017 12:48
-
-
Save henrahmagix/80b5c051239a13a551ec983643956377 to your computer and use it in GitHub Desktop.
Is it really turtles all the way down?
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
'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(); | |
}); |
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
$: 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