html - str_replace in Javascript -


i want str_replace in javascript without using inbuilt function. want scratch code this.

please can have code this? want javascript inbuilt function str_replace ditto without using str_replace.

function replace(string, chartochange, chartoreplace){ var replaced = ""; for(var i=0; < string.length; i++){     if(string[i] == chartochange){         replaced = chartoreplace;     }  } return replaced; } 

js has function replace. go through link: https://www.w3schools.com/jsref/jsref_replace.asp


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -