What's wrong with this code?


#1


It returns the first statement, "You're a glory hunting..." for all the inputs. How do I correct this?


var myTeam = prompt("What team do you support?")
var response = function (teamchoice){
    if (myTeam = "manchester united") {
    return "You're a glory-hunting cunt"}
    else if(myTeam = "manchester city") {
        return "You're a little cumstain"}
        else if (myTeam = "chelsea"){
            return "Chelsea rentboy!"}
            else if(myTeam = "arsenal"){
                return"You're doing it right!"}
                else {return "Who are they?"}}
                console.log(response(myTeam))


#2

Hi in all your if and else if statement you should change the = with ==.. Because
= is for asign a value to a variable
== to compare two value (variable)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.