SyntaxError: Unexpected Identifier in Chrome's 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);