![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
沙子揉碎在眼睛里
你必须狠努力,才能看起来毫不费力
展开
-
ES6 字符串扩展一些常用的方法
1、字符串的遍历 for...of for (let code of 'foo') { console.log(code) // 'f' 'o' 'o' }2、at() : 返回字符串给定位置的字符 ES5提供了charAt()的方法: 'abc'.charAt(0) // 'a' ES6是at()方法 :'abc'.at(0) /...原创 2018-05-10 11:39:27 · 243 阅读 · 0 评论 -
ES6 Math 对象的扩展
1、Math.trunc() : 用于去除一个数的小数部分,返回整数部分。 Math.trunc(1.2) // 1 Math.trunc(false) // 0 Math.trunc(null) // 0 Math.trunc方法内部使用Number方法先转为数值 Math.trunc(NaN) // NaN 如果是无法截取的返回NaN ,比如:字符串‘...原创 2018-05-10 16:50:55 · 168 阅读 · 0 评论 -
ES6 数组的扩展
扩展运算符Array.from()Array.of()数组实例的 copyWithin()数组实例的 find() 和 findIndex()数组实例的 fill()数组实例的 entries(),keys() 和 values()数组实例的 includes()数组的空位1.扩展运算符含义扩展运算符(spread)是三个点(...)。它好比 rest 参数的逆运算,将一个数组转为用逗号分隔的参数...转载 2018-05-15 15:22:16 · 221 阅读 · 0 评论 -
ES6 Promise 对象
Promise 对象 Promise 的含义基本用法Promise.prototype.then()Promise.prototype.catch()Promise.prototype.finally()Promise.all()Promise.race()Promise.resolve()Promise.reject()应用Promise.try()Promise 的含义Promise 是异步编...转载 2018-05-22 16:53:08 · 142 阅读 · 0 评论