Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Node.js Online

function rep() {
    var str = 'Hello World';
    str = setCharAt(str,4,'a');
    console.log("replaced string is",str);
}

function setCharAt(str,index,chr) {
    if(index > str.length-1) return str;
    return str.substr(0,index) + chr + str.substr(index+1);
}
rep();

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.