在Ruby中,我們可以做這樣的如何要求在命令行中問題的NodeJS
print "How old are you? "
age = gets.chomp()
print "How tall are you? "
height = gets.chomp()
print "How much do you weigh? "
weight = gets.chomp()
puts "So, you're #{age} years old, #{height} tall and #{weight} heavy."
會喜歡這個
,但如何做到這一點的NodeJS中?
http://nodejs.org/api/readline.html – jgb