Basic JavaScript: Golf Code help plz

Tell us what’s happening:
Everything is passing except “Bogey” “Double Bogey” and the last two “Go Home!” conditions. I can’t figure out why.

Your code so far

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 (par == par) {

  return "Par";

} else if (strokes == par + 1) {

  return "Bogey";

} else if (strokes == par + 2) {

  return "Double Bogey";

} else {

  return "Go Home!";

}

    

  return "Change Me";

  // Only change code above this line

}

golfScore(5, 4);

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums

I don’t think this line is doing what you want it to. ‘a == a’ is always going to be true.