Skip to content
Advertisement

How do I fix this missing semicolon syntax error in Javascript?

A friend wrote some code for me, and there was one file with a weird syntax error in it. After a bit of hunting, I narrowed it down to this section of code, which should reproduce the error:

var say = functіon(message) {
  alert(message);
  return message;
};

say(say("Goodbye!"));

When I run this, I see an error in the Internet Explorer console that says SCRIPT1004: Expected ';'. I don’t see a semicolon missing anywhere, and I can’t imagine where it wants me to put one.

Where does it expect a semicolon and why does it expect a semicolon there?

Advertisement

Answer

Your issue is the fact that the i in function is the unicode character i. If you change it to a ‘normal’ i it should just work.

But now I’m wondering how the hack 🙂 did you get an unicode character there 😛

unicode error in js

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement