+ 3
Hello guys,, why is this code displaying only the else (veteran) statement for all inputs
Number(prompt("How old are you??")) if(Number<=18){alert( "Up and coming"); } else{alert( "veteran!"); }
4 odpowiedzi
+ 16
I think the problem is because you are using Number which is a function in the condition.
What you should do:
var num = Number(prompt("How old are you??"));
if(num <= 18)
alert("Up and coming")
else
alert("veteran")
+ 13
your welcome @Linus
+ 2
Thanks @Ulisses Cruz !
0
Do you mind demonstrating..? @Meharban