Golf code please

Tell us what’s happening:
Describe your issue in detail here.

it doesn’t run what did I do wrong
Your code so far

var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
if (strokes == 1) {
  return "Hole-in-one!";
} else if (skrokes <= 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 "DoubleBogey";
} else >= par + 3  {
  return "Go Home!";

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

  **Your browser information:**

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

Challenge: Golf Code

Link to the challenge:


This is why I recommend using the array above the function.

Not sure what this syntax is. else means ‘everything else’. There are no conditions.

1 Like

I noticed three things:

  1. In the first else if you wrote skrokes instead of strokes
  2. The else statement does not need a condition
  3. in the last line the console statement is misspelled and it’s missing a ).

Can you try changing these three things and see what happens?

Happy coding!

1 Like

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