xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

ES2021 & ES12

ES2021 & ES12

ES2021 new features

replaceAll

String.prototype.replaceAll

const str = `abc,abc`;
str.replaceAll(`abc`, `xyz`)
// "xyz,xyz"

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll


'🍏🍏🍋🍋🍊🍊🍓🍓'.replace(/🍏/g, '🥭');
// "🥭🥭🍋🍋🍊🍊🍓🍓"
'🍏🍏🍋🍋🍊🍊🍓🍓'.replaceAll(`🍏`, '🥭');
// "🥭🥭🍋🍋🍊🍊🍓🍓"

https://v8.dev/features/string-replaceall

https://www.chromestatus.com/feature/6040389083463680

Promise.any

Logical Operators and Assignment Expressions

Numeric Separators

WeakRefs

Intl.ListFormat

dateStyle and timeStyle options for Intl.DateTimeFormat

refs

https://dev.to/albertomontalesi/everything-new-coming-in-es2021-2l5l



©xgqfrms 2012-2025

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


posted @ 2020-07-30 21:24  xgqfrms  阅读(433)  评论(8编辑  收藏  举报