If/Else statements


#1

//I don't understand this. Whenever you do an if/else statement, and then do a confirm in the statement's curly braces with the user's answer being an answer different from what the if statement has, (example, them clicking the "ok" button) it runs the if and the else statement.
Example:
var userAnswer = confirm('Are you cool?');
if(userAnswer = true)
{
confirm('Ok')
}
else(userAnswer = false)
{
confirm('Think better of yourself!')
}

//If you pick "cancel" it runs the if and the else statement.


#2

try this

var userAnswer = confirm('Are you cool?');
if(userAnswer){
    confirm('Ok');
}
else{
    confirm('Think better of yourself!');
}