I tested this javascript in Chrome's Javascript console and it returned SyntaxError: Unexpected Identifier
.
I got this code from a tutorial and was just testing Chrome's console so i expected it to work, unless I'm using the console wrong?
Code:
var visitorName = "Chuck";
var myOldString = "Hello username. I hope you enjoy your stay username.";
var myNewString = myOldString.replace ("username," visitorName);
document.write("Old String = " + myOldString);
document.write("<br/>New string = " + myNewString);
Output:
SyntaxError: Unexpected identifier