Continuing the discussion from freeCodeCamp Challenge Guide: Golf Code:
honnestly this is the most difficult task that i have not been able to understand in Javascript even after going through the solutions i still dont fully grasp it. but i get the idea. if anyone can help i will appreciate more.
I think you might need to be a little more specific about what you donāt understand. It sounds like you already looked at the possible solutions in the hints. What donāt you understand about those?
There are few things you can pin point when exploring the task. First, your function is meant to return a string, one of the listed. To be returned, each string has a condition listed. All the conditions has that in common, they compare the strokes
with the par
, which are parameters provided when calling the function. For example, if the strokes are equal par + 2, we return the string āDouble Bogeyā. If the strokes are less or equal par - 2, we return āEagleā. And so onā¦ A straight forward solution would be to list a number of conditions, for every case/string listed. The order of conditions can also be of importance
slept over it and now i fully understand. thank you.
This really helped alot
They are asking you to write a function whereby given any stroke, either less than or greater than whatever par that is specified, it will correspond with the output(or return) section in the table given.
This is how i did mine:
Mod Edit: SOLUTION REMOVED
so I had a fun experience with this one. after passively trying to understand the challenge overnight(as recommended), and trying to build and correctly arrange the code, then going to the forums for help and inspiration but no help(this time), Finally I had my final solution perfect in every way, yet when I clicked āRun the Testsā, nothing happened. so eventually, after trying many changes, and ideas from the forums, I reverted to my first "final solution, which still did not work.
WHAT DID WORK:
CUT the entire code out, refresh the page, paste the code back in, Run the Tests.
what a joke.
If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Thank you.