Nested if statement, logic operator and regular expression
<html>
<head>
<title></title>
</head>
<body>
<script type = "text/javascript" >
var inputNum = prompt("Please enter a number between 50 and 100:");
if (isNaN(inputNum)) {
if (inputNum.match(/one|two|three|four|five|six|seven|eight|nine|ten/)) {
document.write("it is in English");
} else {
document.write(" not a number.");
}
}
else if ((inputNum > 99) || (inputNum < 51)) {
document.write(inputNum + ", is not between 50 and 100.");
}
</script>
</body>
</html>
Related examples in the same category