Hi, I’m trying to check if the value of an input is less or bigger 10 then return message depending on value but it is not working …what is wrong with my code…thanks in advance
<label>Enter Age:</label>
<input type="text" id="age" placeholder="Your Age">
<button type="button" value= "submit" id = "yourage" onclick="calcAge()">Submit</button>
</form>
<script>
function calcAge(){
let getAge = parseInt(document.querySelector("#age").value);
if(getAge < 10){
return "Sorry , you are to young";
}else if (getAge >= 10){
return "Hi, you are welcome";
} else {
return "Entry is wrong";
}
}
</script>