# A bit confused on the string "Birdie" in the Golf code challenge

Tell us what’s happening:
Describe your issue in detail here.
Hello everyone! I’m a bit confused on the “Birdie” string for Golf code Challenge. I made a few conditional’s that I’d thought woud work, but is FCC looking for a specific conditional statement to answer the question. I just learned all the signs a few days ago so I may be a bit new at this, however I’m just a bit confused. Below, is what i have currently, and the above turned out ok but not Birdie. Thanks

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 || par == 1) {
return "Hole-in-one!";
} else if (par - 2 <= 3 || strokes - 2 <= 3) {
return "Eagle";
} else if (par - 1 < 7 && strokes - 1 < 5 ) {
return "Birdie";
}
return "Change Me";
// Only change code above this line
}

golfScore(5, 4);

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Where are you getting your numbers from?
I think you’re misunderstanding the challenge. The conditionals should be based on the difference between strokes and par. Read the instructions again carefully.

1 Like

but is FCC looking for a specific conditional statement to answer the question

Unit tests are usually only concerned with the output, not how it’s done. True, some of the FCC tests do confirm that a certain things is used or not used, but that is not normal and I don’t think that would be the case here - the description would tell you if it were.

When I log out from your code:

console.log(golfScore(5, 4));

It replies with “Eagle”. That should not be the case, it should be “Birdie”, so…

Looking at that code:

} else if (par - 2 <= 3 || strokes - 2 <= 3) {
return "Eagle";

I don’t understand the logic there. If par -2 is less than or equal to 3? What does par have to do with it. As the problem defined:

<= par - 2 “Eagle”

So, the strokes is less than or equal to par minus 2. That is not the logic you have here.

I would fix that logic.

1 Like

thank you for responding! and i think i mis read lol

Thanks for responding. Interesting, i will fix that

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