1
これは簡単なことだと思われますが、ドキュメントで何も見つかりません。ノードjs rlが最後のプロンプトを繰り返す
質問したい質問があります。そのうちの1つは、有効な回答が得られるまで再質問します。このように:
rl.question('Author: ', function(answer) { //question #1
author = answer; //Use that value, move to next question
rl.question('What Title should be shown in browser tabs for this site? ', function(answer) { //question #2
title = answer; //Move on...
rl.question('Include the tippy.js library? ', function(answer) { //question #3
if (answer == 'y' || answer == 'yes' || answer == 'Yes' || answer == 'Y') {
console.log("Will include tippy.js");
//Done with app
} else if (answer == 'n' || answer == 'no' || answer == 'N' || answer == 'No') {
console.log("Will not include tippy.js");
//Done with app
} else {
console.log("Invalid response");
//Re-ask question #3 without asking questions #1 and #2
}
});
})
});
提案ですか?ご検討いただきありがとうございます。
:
次に、あなたのコードは次のように読み取ります。あなたの質問は何ですか? – AJFarmar
私は、コメントが「#1と#2の質問をせずに質問3を再入力してください」と言う箇所を何にするべきかわかりません –