I don't really understand the if and else statement, can someone pls explain cuz I'm lost | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

18th Sep 2019, 7:28 PM
Amu Timilehin
2 Answers
+ 1
if you are beautifull you have a lot of girls else you have none // How simple is this ? ^^
18th Sep 2019, 8:57 PM
Catalin Popinciuc
Catalin Popinciuc - avatar
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
18th Sep 2019, 7:37 PM
Taste
Taste - avatar