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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -