the code always thinks num1 is the smaller number ,even if it's not + if the second input is odd, but the first is even, then the output is num1 the smaller even instead of "second input is odd, correct it"
+I would also need a "Both numbers are the same, correct it" output
this would be my wrong solution, how could I make it work?
<body>
<input id="num1">
<input id="num2">
<button onclick="myFunction()">Calculate</button>
<p id="p"></p>
</body>
const p = document.getElementById("p")
function myFunction() {
var num1, num2;
num1 = Number(document.getElementById("num1").value);
num2 = Number(document.getElementById("num2").value);
if(num1%2==0 >num2%2==0){
p.innerHTML=num2+" is the smaller even number"
if(num1%2!=0){
p.innerHTML=num1+" first input is odd, correct it"
}
else {
p.innerHTML=num2+" second input is odd, correct it"
}
}
else{
p.innerHTML=num1+" is the smaller even number"
}
}