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


Flag Counter

©xgqfrms 2012-2020

www.cnblogs.com 發布文章使用:只允許注冊用戶才可以訪問!



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM