自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 资源 (1)
  • 收藏
  • 关注

原创 ES6之Iterator

ES6之Iterator​ ES6如何让不支持遍历的数据结构“可遍历”呢?let authors={ allAuthors:{ fiction:['dhede','fefe','wqeqw'], science:['efg','ffda','feaf'], fantasy:['w','dsads','wef'] }, Address:[]}//建立接口authors[Symbol.iterator]=function(){ let allAuthors=this.allAuth

2020-07-19 17:45:07 106

原创 ES6之Generator

ES6之Generator​ ES6如何让遍历“停”下来?​ 使用场景:例如抽奖奖项名单一名一名公布。function * loop(){ for(let i=0;i<3;i++){ yeild console.log(i) //使用yeild暂停函数的执行 }}const l=loop()l.next() //0l.next() //1l.next() //2l.next() //无返回​ yeild没有返回值。function * gen()

2020-07-19 17:44:33 108 1

原创 ES6之Proxy

ES6之ProxyProxy用法​ Proxy 用于修改某些操作的默认行为,可以理解成,在目标对象之前架设一层“拦截”,外界对该对象的访问,都必须先通过这层拦截,因此提供了一种机制,可以对外界的访问进行过滤和改写。let o={ price:190, name:'xiaoming'}let d=new Proxy(o,{ get(target,key){ if(key==='price'){ return target[key]=210 }else{ return tar

2020-07-19 17:42:47 125

原创 ES6之Reflect语法

ES6之Reflect语法Reflect 用法​ 反射机制,先调用.apply,在调用方法。//ES5Math.floor.apply(null,[3.75])//ES6Reflect.apply(Math.floor,null,[4.72])//4let price=91.5Reflect.apply(price>100?Math.floor:Math.ceil,null,[price])//92Reflect实现类的实例//newlet d=new Date()d

2020-07-19 17:42:03 365

原创 ES6之Promise

ES6之Promisefunction loadScript(src){ //pending undefined return new Promise((resolve,reject)=>{ let script=document.createElement('script') script.src=src script.onload=()=>resolve(src) script.onerror=(err)=>reject(err) document.he

2020-07-19 17:32:54 97

原创 ES6之解构赋值

ES6之解构赋值数组的解构赋值//简单变量赋值let arr=['hello','world','a','b']let [firstName,,thName]=arrconsole.log(firstName,thName)//hello alet arr='abcd'let [firstName,,thName]=arrconsole.log(firstName,thName)//a c //对象属性赋值let user={name:'s',age:11}[user.name

2020-07-14 22:14:32 79

原创 ES6正则与字符串处理

ES6正则与字符处理sticky粘连语法const s=aaa_aa_aconst r1=/a+/gconst r2=/a+/yconsole.log(r1.exec(s)) //aaaconsole.log(r2.exec(s)) //aaaconsole.log(r1.exec(s)) //aaconsole.log(r2.exec(s)) //null//原因:只匹配除去第一次匹配的结果字符处理​ 字符正则需习惯性加(/u)​ 写法:判断码典是否为对应的某个字符c

2020-07-14 22:09:42 188

原创 ES6函数篇

ES6函数篇函数参数function f(x,y=7,z=x+y){ console.log(f.length) //返回函数参数没有默认值的格式 打印:1 return x*10+z console.log(f(1)) //18}//Rest操作 function sum(base,...nums){ let num=0 nums.forEach(function(item){ num+=item*1 }) return base*2+num

2020-07-14 21:20:30 98

原创 ES6之Object篇

ES6之Object篇Objectlet x=1,y=2,z=3let obj={ x, y, [z+y]:6, //常规函数 hello(){ console.log('hello') } //异步函数 *hello1(){ console.log('hello1') }}console.log(obj) //x:1,y:2,5:6,helloconsole.log(obj.hello1) //无打印Set存储数据​ 所存储的数据是唯一的,Set接受

2020-07-14 21:19:28 164

原创 ES6之Class篇

ES6之Class篇ES6 Class声明class Animal{ //构造函数 constructor(type){ this.type=type } //方法 eat(){ console.log('i am eating') }}let dog=new Animal('dog')console.log(dog)dog.eat()typeof Animal //functionES6属性的读写操作let _age=4class Animal{ const

2020-07-14 21:15:00 114

原创 ES6之Array篇

JavaScript之Array篇Array 遍历for语句const arr=[1,2,3,4,5]for(let i=0;i<arr.length;i++){ if(arr[i]===2){ continue } console.log(arr[i])}forEach语句arr.forEach(function(item){ if(item===2){ break //报错 } console.log(item)})for语句与forEach语句区别​

2020-07-14 21:13:07 183

快速搞定前端技术一面.pdf

前端面试题

2020-11-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除