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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -