my function() is not working or the value is not converting to a number
my function() is not working or the value is not converting to a number Been stuck here ALL day long trying to figure out what is wrong with my syntax. Here’s my code… I’d like to verify if Number1 is > than Number 2 . However, whenever I tried to run the code I always getting false. Please help me.. PS. I am new to coding :( var num1 = document.getElementById('num1'); var num2 = document.getElementById('num2'); var x = Number(num1); var y = Number(num2); function higherThan(x, y){ x > y? alert(true) : alert(false); } Numb1: <input type="number" id="num1"><br> Numb2: <input type="" id="num2"><br> <button onclick="higherThan();">Is Higher Than?</button> document.getElementById('num1') gets the whole element. Change it to document.getElementById('num1').value to get the value – Manually Overridden ...