Answers for "Replace all ocourrences in JS"

0

Replace all ocourrences in JS

let str = 'hotdog dog'.replace(new RegExp('dog','g'), 'cat');
console.log(str) //output: hotcat cat
Posted by: Guest on April-18-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language