String.prototype.replaceAllintermediate'foo bar foo'.replaceAll('foo', 'baz') // β 'baz bar baz'
'banana'.replaceAll('a', 'o') // β 'bonono'Use replaceAll() to replace every occurrence of a search string or regex (with /g flag) with the replacement.
When passing a regex to replaceAll, it must have the g flag.
Challenge: Implement removeVowels(str) that removes all vowels using a regex.
removeVowels('hello world') // β 'hll wrld'