Can someone please explain why user story 10 is correct?
golfScore should return "Go Home!" if strokes is greater than par plus 3
My code passes all but test 13.
I put the condition:
strokes > par + 3
And test 13 doesn’t pass.
I put the condition as
strokes >= par + 3
And the code passes.
Should the user story should be changed to reflect the condition that passes?
I have seen this issue but the user story hasn’t been updated.
opened 10:25AM - 21 Aug 25 UTC
closed 05:07PM - 24 Aug 25 UTC
help wanted
scope: curriculum
### Describe the Issue
User story number 10:
> golfScore should return "Go Home… !" if strokes is greater than par plus 3.
with the attached code, it should work.
However, this test case looks wrong:
https://github.com/freeCodeCamp/freeCodeCamp/blob/27c2dacc465def67aaa903b90a128e0c8d80b09a/curriculum/challenges/english/25-front-end-development/lab-golf-score-translator/689f7996426c1534fa5bea66.md?plain=1#L106
I’m not sure if the solution should be edited, since the final `return` statement isn’t specific to the case mentioned in the user story:
https://github.com/freeCodeCamp/freeCodeCamp/blob/27c2dacc465def67aaa903b90a128e0c8d80b09a/curriculum/challenges/english/25-front-end-development/lab-golf-score-translator/689f7996426c1534fa5bea66.md?plain=1#L153
---
Minor edits:
- https://github.com/freeCodeCamp/freeCodeCamp/blob/27c2dacc465def67aaa903b90a128e0c8d80b09a/curriculum/challenges/english/25-front-end-development/lab-golf-score-translator/689f7996426c1534fa5bea66.md?plain=1#L19
add a period at the end.
- https://github.com/freeCodeCamp/freeCodeCamp/blob/27c2dacc465def67aaa903b90a128e0c8d80b09a/curriculum/challenges/english/25-front-end-development/lab-golf-score-translator/689f7996426c1534fa5bea66.md?plain=1#L21
`should return`
### Affected Page
https://www.freecodecamp.org/learn/full-stack-developer/lab-golf-score-translator/build-a-golf-score-translator
### Your code
```js
const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
if(strokes == 1) return names[0];
if(strokes <= par - 2) return names[1];
if(strokes == par - 1) return names[2];
if(strokes == par) return names[3];
if(strokes == par + 1) return names[4];
if(strokes == par + 2) return names[5];
if(strokes > par + 3) return names[6];
}
```
### Expected behavior
Apply the minor edits, and make the agreed edit once this issue has been triaged.
### Screenshots
_No response_
### System
N/A
### Additional context
_No response_
ILM
September 1, 2025, 7:30am
2
the user story has been updated, see here
1. You should create a function named `golfScore`.
1. `golfScore` should take two numeric arguments, which are the par for the course and the amount of strokes made.
1. `golfScore` should return a string.
1. `golfScore` should return `"Hole-in-one!"` if `strokes` is `1`.
1. `golfScore` should return `"Eagle"` if `strokes` is less than or equal to `par` minus `2`.
1. `golfScore` should return `"Birdie"` if `strokes` is equal to `par` minus `1`.
1. `golfScore` should return `"Par"` if `strokes` is equal to `par`.
1. `golfScore` should return `"Bogey"` if `strokes` is equal to `par` plus `1`.
1. `golfScore` should return `"Double Bogey"` if `strokes` is equal to `par` plus `2`.
1. `golfScore` should return `"Go Home!"` if `strokes` is greater than or equal to `par` plus `3`.
# --hints--
You should create a function named `golfScore`.
```js
assert.isFunction(golfScore);
```
`golfScore` should take two parameters.
the issue is that the condition where strokes is equal to par + 3 is missing if you write
a1legalfreelance:
strokes > par + 3
depending on how you have written things that would mean your function is returning undefined or the wrong thing
I may be completely missing something.
You’re right that my code didn’t pass when I wrote
strokes > par + 3
User story 10 is prompting users to write the wrong answer.
“golfScore should return "Go Home!" if strokes is greater than par plus 3.“
Why isn’t the user story changed to ““golfScore should return "Go Home!" if strokes is greater than or equal to par plus 3.““ User story 5 adds “or equal to”, for consistency shouldn’t it also be added to user story 10?
ILM
September 1, 2025, 6:15pm
4
this has already been fixed, look at the code file I posted
1 Like
Ah got you. It hasn’t gone live yet on the page