SyntaxError: unknown: Missing semicolon. (4:16)

Tell us what’s happening:
Describe your issue in detail here.
SyntaxError: unknown: Missing semicolon. (4:16)

2 | function golfScore(par, strokes) {
3 | if (strokes == 1) {

4 | return names{0}
| ^
5 | } else if (strokes <= par - 2) {
6 | return names{1}
7 | } else if (strokes == par - 1) {

  **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 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 if (strokes >= par + 3) {
  return names{6}
// Change these values to test 

Strokes     Return 
1          "Hole-in-one!"
<= par - 2 "Eagle"
par - 1    "Birdie"
par        "Par"
par + 1    "Bogey"
How do I fix this?

  **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.159 Safari/537.36 Edg/92.0.902.84

Challenge: Golf Code

Link to the challenge:

What do you think you’re referring to with the curly braces here? Javascript doesn’t understand your syntax.

To the names of the pars & strokes

Now it’s saying unterminated comment how do I fix that

Is your comment, the /*, closed with a */ somewhere?

I have it at the bottom where it says strokes & returns above strokes and that would be the / *

Now it’s telling me to return the strings in which I’ve already done

I think you’ll need to post your updated code.

How do I do that do u have a phone number I can reach u at


and your function is :wave: golfScore

In the FCC editor (which is what you are typing these messages in) you wrap your code with three backticks on a single line, then your code below those backticks, then three backticks again on a line following your code. Or you can click the </> button in this editor and it will add the backticks for you and you just copy/paste in between them.


output is : Birdie

1 Like

Dude (generic term), I don’t think they want us just posting answers. We try to gently guide them to solving the problem.

1 Like

It is not the answer he got to do a lot
thet is fixing his err…

I got it I Figured it out thanks guys

1 Like

I am a girl :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl: :rofl:

1 Like

Sorry lol guys & girls

1 Like

Sometimes it is useful, for educational understanding, to compare a “before and after”. Seems to me this is the intent.

And yes, the after catches those things i was pointing out - but for educating, consider throwing in inline comments noting what you’ve changed.

In all though, solid support. I appreciate you! :grin:

When someone pushes your wheel, it’s no big deal. Sometimes the more you look at it, the more you don’t see the mistake.
sorry. . .

1 Like

Lol I’m telling you, you’re fine. You did exactly right. I truly do appreciate you, and we as a community are better with you in.

No sorry. You do well.

1 Like