I have somewhere on website a specific text, let\'s say \"lollypops\", and I want to replace all the occurrences of this string with \"marshmellows\". The problem is that I
var string ='my string' var new_string = string.replace('string','new string'); alert(string); alert(new_string);