Tell us what’s happening:
Hey y’all, I am so stuck on this.
I have looked at the hints and solutions to this, and have tried to do it in multiple browsers, but for some reason it is not taking, it is giving me an error for par, and then for the bogey, double bogey, and go home.
Any help is appreciated, I really cant figure out what I am doing wrong!
Your code so far
const 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"
}
else if (strokes == par + 3) {
return "Go Home!"
}
else {
return "Change Me";}
// Only change code above this line
}
golfScore(4, 4);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Golf Code
Link to the challenge: