Confused with Golf Code

Tell us what’s happening:
Why does a Par equal to 4 par, 1 stroke?

golfScore(4, 1) should return “Hole-in-one!”

I cannot get my head around it to even attempt the code.
Your code so far

var names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];
function golfScore(par, strokes) {
// Only change code below this line

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

// Change these values to test
golfScore(5, 4);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0.

Challenge: Golf Code

Link to the challenge:

Because 1 stroke means the player hit the ball once to putt the ball - a hole-in-one (stroke).
The par is irrelevant for a hole-in-one. the par could be 2 or 10, but if strokes is 1, it is a hole-in-one.

so technically you could put golfScore(6, 1) because the stroke value is 1?

1 Like

Yes! :slight_smile:
Try changing the numbers and resubmitting the challenge to see what happens.

1 Like