Hi guys i know this code is too easy but i'm new in javascript and i'm still learning it . this code gets a value from user then shows an answer but it dosen't matter if value is number or not it just says = its a number .
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--Javascript starts-->
<script>
var age = prompt("How old are you ?","18");
if(age == NaN)
{
alert("its not a number");
}else
{
alert("its a number");
}
</script>
<!--End of Javascript-->
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire