![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
es6
进击的小野马
在前端的路上奔偏了,(ง •̀_•́)ง
展开
-
es6的遍历器
interator 遍历器 通过指针移位来遍历集合的 next() {value:0,done:true} value:指值 done:指是否遍历结束 true false { let myInterator = (args) => { let index = 0; return { next() { retu.原创 2021-03-26 13:07:16 · 117 阅读 · 0 评论 -
es6的函数
es6 函数增加默认值 { function method(x, y = 7) { console.log(x, y); } method(); function getdata({ a, b = 8 }) { console.log(a, b); } getdata({ a: 1 }); .原创 2021-03-26 13:02:26 · 104 阅读 · 0 评论 -
es6的字符串遍历
for of 遍历 let str='abcdef'; for(let char of str) { console.log(char); } 字符串新增的方法 let s="\uD842\uDFB7"; console.log(s); let str="a"; let s1=str.charCodeAt(0).toString(16);//unicode 16进制 .原创 2021-03-26 12:57:28 · 458 阅读 · 0 评论 -
es6的变量解构赋值
ES6 允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构。 解构赋值:按照相同的结构对应给值 { let a = 2; let b = 3; let t; t= a; a=b; b=t; //a b 值互相交换 //let [a,b]= [3,2]; c原创 2021-03-26 12:53:40 · 105 阅读 · 0 评论 -
ES6 里面的let和const
ES6 新增了let命令,用来声明变量。它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效。 let let声明变量会限制作用域 只能在当前代码块作用域内部有效 let 声明的变量不能被提前声明 不能被重名 { var a = 1; let b = 2; } a;//1 b;//1.let和const.html:56 Uncaught ReferenceError: b is not defined at 上面代码在代码块之中,分别用let和var声明原创 2021-03-13 16:15:38 · 60 阅读 · 0 评论