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
Post a Comment