1.nodejs对replaceAll的支持版本
nodejs 15.X开始支持replaceAll方法
官网说明:
2020-10-20, Version 15.0.0 (Current), @BethGriggs
.....
V8 8.6 - #35415
The V8 JavaScript engine has been updated to V8 8.6 (V8 8.4 is the latest available in Node.js 14). Along with performance tweaks and improvements the V8 update also brings the following language features:
Promise.any()
(from V8 8.5)AggregateError
(from V8 8.5)String.prototype.replaceAll()
(from V8 8.5)- Logical assignment operators
&&=
,||=
, and??=
(from V8 8.5)
官网地址:
2.nodejs14.X以下replaceAll的处理方法
searchValue.split(aaa).join(bbbb);
将searchValue中的元素aaa替换成bbbb