+ 1
I am checking whether the number is odd or even. But it is showing error messages. Please help
6 Respostas
+ 1
<!DOCTYPE html>
<html>
<head>
<title>boolean example</title>
<script type="text/javascript">
var userInput = prompt("Enter a number :", " ");
var message = ("");
if(userInput % 2 == 0)
message= " Your number is even"
else
message= " Your number is odd"
alert(message);
</script>
</head>
<body>
<form>
</form>
</body>
</html>
+ 1
Still not working
+ 1
Thanks Lakshay Mittal 🙏🙏
+ 1
Lakshay Mittal why function is not used in this case.
+ 1
Okay great
0
Avinash
Because it made no sense there.