let str = 'JS will, JS will rock you!'; let newStr = str.replace(/JS/g,'JavaScript'); console.log(newStr); Code language: JavaScript (javascript) //output :JavaScript will, JavaScript will rock you!