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 发布文章使用:只允许注册用户才可以访问!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13406420.html
未经授权禁止转载,违者必究!