This is a javaScript exercise I was given in the JS and data structure bootcamp on freecodecamp.org. Basically its passed a function with two values (par, stoke). And a as you should know, In the game of Golf, each hole has a par, meaning, the average number of strokes a golfer is expected to make in order to sink the ball in the hole to complete the play. Depending on how far above or below par your strokes are, there is a different nickname.
You can see in the table below, how the function parameter is correlated with its return value.
Strokes | Return |
---|---|
1 | "Hole-in-one!" |
<= par - 2 | "Eagle" |
par - 1 | "Birdie" |
par | "Par" |
par + 1 | "Bogey" |
par + 2 | "Double Bogey" |
>= par + 3 | "Go Home!" |