Javascript examples for Statement:if
Check string value for three options with if statement
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//w w w. j a v a2 s. co m var userChoice = 'rock'; if ((userChoice != "rock") && (userChoice != "paper") && (userChoice != "scissors")) { console.log("inappropriate choice"); } else { console.log("appropriate choice!"); } } </script> </head> <body> </body> </html>