SyntaxError: Unexpected Identifier in Chromes Javascript console

SyntaxError: Unexpected Identifier in Chromes Javascript console

The comma got eaten by the quotes!

This part:

(username, visitorName);

Should be this:

(username, visitorName);

Aside: For pasting code into the console, you can paste them in one line at a time to help you pinpoint where things went wrong 😉

Replace

 var myNewString = myOldString.replace (username, visitorName);

with

 var myNewString = myOldString.replace(username, visitorName);

SyntaxError: Unexpected Identifier in Chromes Javascript console

I got this error Unexpected identifier because of a missing semi-colon ; at the end of a line. Anyone wandering here for other than above-mentioned solutions, This might also be the cause of this error.

Leave a Reply

Your email address will not be published.