I don't Understand!

Tell us what’s happening:


Someone does know why this code return true ever?

continuer = “S” or continuer = “N” the if statement return true is the “break” jump out loop!

n is a truthy value so that statement will always execute

the === is evaluated first
it doesn’t matter if it returns true or false as both true || 'n' and false || 'n' will make the if statement execute

1 Like

If continuer === “S” ?

using prompt() in this case sends a message to the user to input either S or N

// continuar will be set to the users input
// === means isEqualTo
// break; will stop any loop
if (user input is equal to N or n){ stop the while loop }
1 Like