Code that ask if variable is true or false


#1

Hello, I made this code:
var needCoffee = true;
if (needCoffee) {
console.log('Finding coffee');
} else {
console.log('Keep on keeping on!');
}
and I have a question: how I can make a code which ask you if var needCoffe is true or false?
Where I can learn that?
PS: I saw that is a new javascript lessons and I'm at Control Flow 3.Comparasion Operators.Thanks


#2

you can use prompt() to get user input, this will give you a string, not a boolean value


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.