ES6新增了哪些字符串处理函数?
【概念释义】
ES6 增强 String:模板字符串、includes/startsWith/endsWith 语义化查找、repeat 重复、padStart/padEnd 填充、以及 Unicode 感知 的 codePointAt、String.fromCodePoint、正则 u 修饰符配套方法。
减少对传统 indexOf、手动 pad 的依赖,代码意图更清晰。
【基础使用】
javascript
const s = 'hello-world';
s.includes('world'); "qb-hl-comment">// true
s.
登录查看完整 1378 字
回答讨论
暂无讨论,登录后可抢先发言