var str = "lala";
var newStr = str.replace('l', 'm');
The value of newStr becomes 'mala', as the replace method finds the first occurrence of character in the string and replaces the character and then stops.
But I want the output "lama". How can I achieve it?