Unable to to watch video and receiving errors

Tell us what’s happening:

I am receiving errors and I am not able to watch the video on freeCodeCamp

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 (strokes<= par - 2) {
return names[1];
}

return "Change Me";
// Only change code above this line
}

golfScore(5, 4);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15.

Challenge: Golf Code

Link to the challenge:

That capital I in If will throw an error.

1 Like

Do you have any idea why I can no longer watch the videos ?

Also, thank you for correcting my coding dilemma!!! Your nickname should be Eagle eye…lol Thanks again!

Can’t help concerning the video, sorry, but as for the error, you don’t need eagle eyes because JavaScript will help you with that :smiley:
I ran your code in the challenge and this was the error message:

SyntaxError: unknown: Unexpected token, expected ";" (4:18)

You’ll really benefit from reading the error messages closely and trying to understand what they mean. In this case, a Syntax Error means that JavaScript stumbled upon something that it doesn’t know (often, that’s a spelling mistake, or a missing bracket/curly brace), and it also tells you which line caused the error (4 in this case). From there, it’s not too difficult to spot the problem.

1 Like