My problem is, when you type an age, it always says "Invalid Age" w/c falls in the default condition. I dont know how to figure out this. Its my codes. Help me to fix this. Thanks!
<html>
<body>
<script type="text/javascript">
var $age = Number(prompt("Enter Your Age: "));
switch ($age)
{
case ($age>='1' && $age<='8') :
document.write('Paramihan ng Toys!');
break;
case ($age>='9' && $age<='18') :
document.write('Pataasan ng Grades!');
break;
case ($age>='19' && $age<='25') :
document.write('Padamihan ng Syota!');
break;
case ($age>='26' && $age<='35') :
document.write('Pagandahan ng Asawa!');
break;
case ($age>='36' && $age<='45') :
document.write('Palakiha ng Income!');
break;
case ($age>='46' && $age<='55') :
document.write('Padamihan, Pagandahan at Pabataan ng kabit!');
break;
case ($age>='56' && $age<='70') :
document.write('Padamihan ng sakit!');
break;
case ($age>='71') :
document.write('Pabonggahan ng Libing!');
break
default :
document.write("Invalid Age!");
break;
}
</script>
</body>
</html>
I hope you can help me.