What is the use of par in condition

I am learning JS and I am on Golf Code module.

The challenge is to create a function with condition so when we enter values in function we should get the answer.

Like

const names = ["Hole-in-one!", "Eagle", "Birdie", "Par", "Bogey", "Double Bogey", "Go Home!"];

function golfScore(par, strokes)

If (stroke >= par){
return names[1];

And so on

I want to what is the use of par in condition

function golfScore(par, strokes) {
// Only change code below this line


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

golfScore(5, 4);

Challenge: Golf Code

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

par is one of the two inputs. It has a meaning in golf but I wouldn’t worry about that too much.

It is important to know conceptually what you are working on or what problem you are trying to solve. So it is important to know the vocabulary.
Par in golf, as stated in the problem, is the average number of strokes a golfer is expected to make in order to sink the ball in the hole to complete the play.

This average might be calculated based on other golfers who have played the game so far in history. The number of strokes they had made before they could sink their ball must have been calculated for all these golfers and their average might have been taken. Something like that maybe.
But the problem here states that if the current golfer takes lesser number of strokes than the par to sink the ball in hole, then give her/him certain tags. Or else if the strokes taken by him/her to sink the ball is equal to the wordly average, par, then give the ‘Par’ tag. Or if the number of strokes made by this player to sink the ball are greater than par, then give him/her certain other tags.

So, it’s basically just comparing the number of strokes made by the golfer to this threshold called par, and then tagging based on that.

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