Whats wrong with my code?


#1


#2

You cant call a function on prompt basically.. If you want you can make a work around by making another variable that upercase the prompt like this:

   var country = prompt("Where do you live?")
   var upperCasePrompt = country.toUpperCase();

   if(upperCasePrompt == "USA"){
    console.log("You Live in U.S.A!")
    }
    else if(upperCasePrompt == "KENYA"){
    console.log("You live in Kenya!")
    }
    else if(upperCasePrompt == "ETHIOPIA"){
    console.log("You live in Ethiopia!")
    }
    else{
    console.log("You live in " + upperCasePrompt.toLowerCase())
    }

#3

i have tried your first two lines of code but even then it is giving me the same error


#4

Turns out you can actually use given functions on prompt.... I still dont understand your problem.. Its exactly the same as this but it works for me..:

var answer = prompt("question to user").toUpperCase();

What Browser do you use?


#5

i am working on chrome


#6

Try refreshing and it would work! I dont know what to say about this..