Hey guys, lately I’ve been having issues with the site not reading my code one bit. I’m pretty sure there’s nothing wrong with my code its just not reading it for some reason.
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 names[0]
}
else if (par <= - 2) {
return names[1]
}
else if (par - 1) {
return names[2]
}
else if (par) {
return names[3]
}
else if (par + 1) {
return names[4]
}
else if (par + 2) {
return names[5]
}
else if (>= par + 3) {
return names[6]
}
// Only change code above this line
golfScore(5, 4);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36.
if (test1) {
//...
} else if (test2) {
//...
} else {
//...
}
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.