Sample Video Frame

Created by Zed A. Shaw Updated 2026-08-31 20:32:57
 

07: Prompting Input

This exercise will teach you about both the npm tool and how to require modules. Before you can type the code in you will need to run some commands to get a module called readline-sync installed. You don't have to use this module but it really helps when asking someone simple questions.

To install readline-sync you run the following command:

$ npm install readline-sync

This may take a while, and when it's done you will see that this module is installed. Then you can test it by running node:

$ node
> const readline = require('readline-sync')
undefined
> readline.question("? ")
? lkjasdf
'lkjasdf'
>

If you get an error, then you didn't install readline-sync correctly. It's difficult to debug these kinds of errors, but email me at help@learncodethehardway.org or contact me on the chat for help.

Previous Lesson Next Lesson

Register for The Pro-Webdev Mega Bundle

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.