I can't figure it out. For me is no mistakes in this

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
if (strokes == 1){
return "Hole-in-one!"
} else if(strokes <= par-2){
return "Eagle"
} else if(strokes == par-1){
return "Birdie"
} else if(strokes == par){
return "par"
} else if(strokes == par + 1){
return "Bogey"
} else if(strokes == par + 2){
return "Double Bogey"

return "Go Home!";
// Only change code above this line

golfScore(5, 4);

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0.

Challenge: Golf Code

Link to the challenge:

If you had used the array given to you it wouldn’t have been a problem. Not saying you have to use it, but it would have helped in this case.


@ferrerioo1988 refer back to Access Array Data with Indexes section and take advantage of the array already typed out for you. This not only helps you avoid typing mistakes, if later on you want to change some things, you’d only have to do it at one place.

1 Like

you have missed simicolons after returning statements.

1 Like

I did it with the array, and it worked.Thanks.