How can the questions be reset or have a specific answer lead to another previous question?
var questions = [{
{
name: 'morefood',
message: 'Do you want more food?',
type: 'list',
choices: [ 'Yes', 'No'],
},{
name: 'choiceoffood',
message: 'Which food do you want more of?',
type: 'list',
choices: [ 'Hamburgers', 'Fries', 'Hotdogs']
when: function(answers) {
return answers.morefood === 'Yes';
}
}, {
name: 'quantityoffood',
message: 'How much more do you want?',
type: 'input',
when: function(answers) {
return answers.quantityoffood === 'Yes';
}
},{
name: 'confirmfood',
message: 'Do you still want more food?',
type: 'list',
choices: [ 'Yes', 'No'], <=========== if yes then goes back to choiceoffood
},
]