I want to use str_replace or its similar alternative to replace some text in JavaScript.
str_replace
var text = \"this is some sample text that i want to re
You can use
text.replace('old', 'new')
And to change multiple values in one string at once, for example to change # to string v and _ to string w:
text.replace(/#|_/g,function(match) {return (match=="#")? v: w;});