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