read input data from terminal with prompt

This commit is contained in:
ericdouglas 2015-06-01 11:44:43 -03:00
parent 7b02d7403f
commit 92778f9ed0

View File

@ -1,18 +1,14 @@
// Modules // // Modules
var prompt = require( 'prompt' ); // var prompt = require( 'prompt' );
// Create a variable x and assign value 3 to it // // Create a variable x and assign value 3 to it
var x = 3; // var x = 3;
// Bind x to value 9 // // Bind x to value 9
x *= x; // or x = x * x; // x *= x; // or x = x * x;
console.log( x ); // console.log( x );
// read input data from terminal // read input data from terminal
process.stdin.resume();
console.log( '' );
prompt.start(); prompt.start();
prompt.get({ prompt.get({
name : 'number', name : 'number',
@ -55,4 +51,4 @@ prompt.get({
// }); // });
// Find the lowest of three numbers // // Find the lowest of three numbers