Golf code not recognizing Par, One Bogey, One Double Bougeys and both "Go Home!"s

I’ve managed to pass all the tests other than the few that I’ve included down below. I’ve tried every iteration of the code that I could think of that would work and for some reason it just is not passing all the tests. I’ve looked around the forum and seen nothing like it so I am just having a moment where I’m not noticing a small mistake somewhere?

<<<Like all good mistakes I figured it out about five minutes after I posted I’m sorry>>>

  **Your code so far**

const 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 names[0];
}else if (strokes <= par - 2) {
return names[1];
}else if (strokes = par - 1){
return names [2];
}else if (strokes == par){
return names[3];
}else if (strokes == par +1){
return names [4];
}else if (strokes == par +2){
return names  [5];
}else (strokes >= par + 3)
return names [6];

// Only change code above this line

golfScore(5, 4);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Challenge: Golf Code

Link to the challenge:

Screenshot 2021-12-29 211849

Sorry here are the tests:

The rubber duck technique never fails.

1 Like