I'm trying to get some code to have a certain message to appear on the screen depending on what answer they give on a question. This is a node application that is using the Inquirer package and every-time that I run the node application, it comes back with "undefined".
{
type: "checkbox",
name: "channels",
message: "Which of these TV channels would you watch?!",
choices: ["Investigation Discovery", "CNN", "Fox News", "TLC"]
}
]).then(function (responses) {
for(let i = 0; i < responses.channels; i++) {
if (responses.channels === 0) {
console.log("You are probably smart");
}`enter code here`
else if (responses.channels === 1) {
console.log("You are probably well informed");
}
else if (responses.channels === 2) {
console.log("You are probably not very well informed");
}
else {
console.log("You are probably an idiot");
}
}
As stated before, it is supposed to return a message in the console depending on what choice was chosen, but it only comes back with "undefined".