No idea how to write this code. PLZ HELP!

No idea how to write this code. PLZ HELP!
0.0 0


Tell us what’s happening:

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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:


What part of the instructions do you not understand?

If you understand the instructions, then have you tried to write out the steps you would take in plain language first?


I’m not sure if you understand the context of the question so let me try and help by explaining the way people count their scores when playing golf.

Basically, every time you play a certain hole, you are told ahead of time how many strokes it usually takes to get the golf ball in the hole. So let’s say you are at hole #1, and you are told that the number of strokes expected here are 3.
Then you play and you get lucky and on the first try, your ball gets in the hole. This is called a ‘hole-in-one’. If it takes you 2 strokes to get your ball in the hole (one stroke less than expected), then this is called a ‘birdie’. And if you get your ball into the hole in exactly 3 strokes , this is called ‘par’ . These golf game terms are used to indicate your strokes in comparison to the expected number of strokes. So if you read the exercise, you can see these terms and other terms as well listed.

The question then wants you to fill out the function ‘golfScore’ such that you have two params . One is the par number (ie. the expected number of strokes) and the other is the actual number of strokes the player made. So for eg. as I explained earlier, if the number of actual strokes made by the player is equal to the par number then you call that a ‘par’ score. If it is one less , a birdie, if it is exactly one, it is a hole-in-one etc.

Does that help you get started? If not, let us know what you are struggling to understand.


Thank you for explaining how the game works, now i understand the game, though i solved it with out knowing the game.