Whats wrong with my code?



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!")
    console.log("You live in " + upperCasePrompt.toLowerCase())


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


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?


i am working on chrome


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