I'm trying to make a script that on input e.g "5" runs a readline question 5 times in a row. So if i put amount as 3, it should ask me 3 questions and will log answer 3 different times.
I've tried this, but can't get it to work.
var readline = require('readline');
var log = console.log;
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("amounts to run", function(amounts){
var i;
for (i = 0; i < amounts; i++){
rl.question("how is your day? ", function(answers){
log(answers)
})
}
});
rl.close();
Thank you in advance!