DEV Community

Discussion on: replaceAll in JavaScript

Collapse
 
jadenconcord profile image
Jaden Concord

I've always just used the RexExp function and didn't know about replaceAll, good to know

Collapse
 
maulik profile image
Maulik

Because replaceAll is bit new. As of August 2020, greenfield browsers have support for the String.replaceAll() method defined by the ECMAScript 2021 language specification. For older/legacy browser we need to either use the regex or split-join (or can use shim/polyfil or babel parser)

Also node v15 supports replaceall but in older versions we can't use it