Using confirm command in a boolean


#1

So this is my code. I want the the computer to record whether the user clicks Ok or Cancel. How do I do that?

confirm("is this sum 10000+768923759834 equal to 768923769834")
if (confirm ==="OK")
{
console.log("You smart dog!")


#2

Hey @2002user2! You forgot your curly braces by the way! So like this:

 confirm("is this sum 10000+768923759834 equal to 768923769834")
if (confirm ==="OK")
{ 
console.log("You smart dog!")
}
else{
console.log("You clicked Cancel")
}

Good Luck!


#3

The result of a confirm dialog is either true or false. (MDN)

Taking that into account, you should be testing for true or false, not OK.