0
I don't really understand the if and else statement, can someone pls explain cuz I'm lost
Number(document.getElementById("age").value); Â if (isNaN(age)) { Â Â Â voteable = "Input is not a number"; Â } else { Â Â Â voteable = (age < 18) ? "Too
2 Answers
+ 1
if you are beautifull
you have a lot of girls
else
you have none
// How simple is this ? ^^
0
isNaN will check if age value is a number or not.
NaN means Not a Number, you can see what qualify as NaN here ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN#Testing_against_NaN )
you can read it like this
if age is Not a Number