There's a dilemma with this code - if you click CANCEL the first time the box pops up, it continues to run. I'm unsure of how to make it redirect to the underlying page when clicked on cancel for the first time.
var numero= prompt ("Enter a number")
var resultado= parImpar(numero);
alert ("The number "+numero+" is "+resultado );
function parImpar (numero){
if (numero %2===0) {
return "even" ;
}
else{
return "odd" ;
}
}
if (window.confirm ("Let's try another number ")){
var numero= prompt ("Choose");
var resultado =parImpar (numero);
alert("The number "+numero+" is "+resultado );
}else{
}
body {
background-color:pink;
}
h1 {
font-weight:bold;
}
p{
font-weight:bolder ;
font-family: Garamond;
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>First web! </h1>
<p>Hi everyone! this is mi first ever page/program. I have been learning for a month now and i need it to understand some javascript functions. Im really fighting with them.</p>
</body>
</html>