0
what is wrong with my code?
var h = prompt("please enter your age"); switch (h){ case 1: alert("you are lying") break; case 2: alert("you are lying") break; case 3: alert("you are lying") break; case 4: alert("you are lying") break; I didn't put the full code, but i feel that the problem is in the beginning
6 Answers
+ 6
@Limitless Really u have limitless knowledge of explaining things in easy way & limitless power of debugging đ
+ 3
var h = Number (prompt("please enter your age"));
switch (h){
case 1:
alert("you are lying")
break;
case 2:
alert("you are lying")
break;
case 3:
alert("you are lying")
break;
case 4:
alert("you are lying")
break;
:
:
+ 1
You need to add a parseInt(h) to make your switch go through an integer instead of a string.
Here's my solution:
https://code.sololearn.com/WW0fFXBzPIpz/?ref=app
+ 1
Thanks man, it works wonders
+ 1
đ
0
cool, glad I could help



