JavaScript Program to Replace Characters of a String
// program to replace a character of a string
const string = 'Mr Red has a red house and a red car';
// replace the characters
const newText = string.replace('red', 'blue');
// display the result
console.log(newText);
Output
Mr Red has a blue house and a red car
