jeudi 18 juin 2015

Compare strings without being case-sensitive

i have problem while i made a variable (its string) in javascript and it will be prompt from user and then with the switch i will check if its is true or not then when i input it upper case it will say its it will identified as a another var. thanks here is my code

var grade = prompt("Please enter your class") ;

switch ( grade ){
    
    case "firstclass" :
         alert("It's 500 $")
         break;
    case "economic" :
         alert("It's 250 $")
         break        ;
    default   :
         alert("Sorry we dont have it right now");

}



Aucun commentaire:

Enregistrer un commentaire