Replacing a Word in a String

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);

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.164.143