Basic JavaScript - Golf Code

Tell us what’s happening:
Hey y’all, I am so stuck on this.
I have looked at the hints and solutions to this, and have tried to do it in multiple browsers, but for some reason it is not taking, it is giving me an error for par, and then for the bogey, double bogey, and go home.
Any help is appreciated, I really cant figure out what I am doing wrong!

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 "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!"
}
else {
  return "Change Me";}
  // Only change code above this line
}
golfScore(4, 4);

Your browser information:

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

Challenge: Basic JavaScript - Golf Code

Link to the challenge:

Hey there, you’re missing a double equals sign == to help the console ‘read’ through one of your conditionals/if statements. Go check and fix from there… it should work then, I think!

I know that feeling of being stuck and sometimes it’s just the syntax. You’ve got this!

Hint: Check above “Double Bogey” if statements/conditionals. :slight_smile:

Thank you so much!!! I just had to correct the double == and then adjust the final “Go Home!” one to have “Strokes >= par + 3”

I appreciate the help a ton :slight_smile: !!

Happy to help, make sure to double check that ‘syntax’ - gets me all the time! Cheers!

Oh, and if you’re satisfied with my answer, if you can mark it as the solution it’ll help me on FCC forums :slight_smile: Thanks!

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