# Golf code Challenge Problem

Hi I cannot seem to figure out why my code is not right. It says the “Hole-in-one” is right but none of the other options are correct. Thanks!

``````
function golfScore(par, strokes) {
// Only change code below this line
if (strokes = 1) {
return "Hole-in-one!";
}
else if (strokes <=par-2) {
return "Eagle";
}
else if (strokes = par - 1) {
return "Birdie";
}
else if (strokes = par) {
return "Par";
}
else if (strokes = par + 1) {
return "Bogey";
}
else if (strokes = par + 2) {
return "Double Bogey";
}
else if (strokes >= par + 3) {
return "Go Home!";
}

return "Change Me";
// Only change code above this line
}

``````

I can not tell if you deleted the var count = 0; line but it you did, make sure to add it back in.

Assuming you still have the line I mention above, several of your else if statements are using incorrect syntax for the condition.

Hint: Do not confuse the assignment operator with an equality operator.

EDIT: I did have to change = to == to get it to work. Thank you!

``````
var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
// Only change code below this line

if (strokes == 1) {
return "Hole-in-one!";
}
else if (strokes <= par-2) {
return "Eagle";
}
else if (strokes == par - 1) {
return "Birdie";
}
else if (strokes == par) {
return "Par";
}
else if (strokes == par + 1) {
return "Bogey";
}
else if (strokes == par + 2) {
return "Double Bogey";
}
else if (strokes >= par + 3) {
return "Go Home!";
}

return "Change Me";
// Only change code above this line
}

// Change these values to test
golfScore(5, 4);

``````