June 2014
Intermediate to advanced
696 pages
38h 52m
English
Another common String object task is replacing one substring with another. To replace a word or phrase in a string, you use the replace() method. The following code replaces the text "<username>" with the value of the variable username:
var username = "Brad";var output = "<username> please enter your password: ";output.replace("<username>", username);
Read now
Unlock full access