Javascript examples for String:replace
Search and Replace in a String
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*www . j a v a 2s . co m*/ console.log(findAndReplace("field", 'fd')); console.log(findAndReplace("grass", 'gs')); function findAndReplace(a, b) { return b.split("").reduce(function(a, s) { return a.replace(s, ''); }, a); } } </script> </head> <body> </body> </html>