![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
xj-L
哈哈哈哈哈哈
展开
-
ES6--Proxy
本篇文章转载自我的个人博客ProxyProxy可以理解为在对象前架设一个拦截层(过滤与改写)定义:var proxy = new Proxy(target,handler);自带方法:get(target,propKey,receiver);set(target,propKey,value,receiver);has(target,propKey);deleteP...原创 2018-08-02 11:48:23 · 164 阅读 · 0 评论 -
ES6--Class的继承(上)
本篇文章转载自我的个人博客extendsES6中通过extends关键字实现继承class ColorPoint extends Point { constructor(x, y, color) { super(x, y); //调用父类的constructor(x,y) this.color = color; } toString() { return this....原创 2018-08-02 11:51:09 · 427 阅读 · 0 评论 -
ES6--Async
本篇文章转载自我的个人博客async对Generator函数的改进: Generator执行必须靠执行器(类似co模块),async函数自带执行器 返回值为Promise对象,则async函数可以看成封装多个异步操作的Promise对象 async表示异步操作,await表示紧跟在后面的表达式需要等待结果 co模块约定,yield命令后面只能...原创 2018-08-02 11:52:38 · 346 阅读 · 0 评论 -
ES6--Async函数的实现
本篇文章转载自我的个人博客async function fn(){ //...}//等同于function fn(args){ return spawn(function* (){ //... });}所有async函数都可以写成第二种形式,其中spawn函数是自动执行器spawn函数实现:function spawn(genF){ return new P...原创 2018-08-02 11:55:12 · 285 阅读 · 0 评论 -
ES6--Class的继承(下)
本篇文章转载自我的个人博客类的prototype和__proto__1、Class同时具有prototype和__proto__2、子类的__proto__属性表示构造函数的继承,总是指向父类3、子类的prototype属性的__proto__属性表示方法的继承,总是指向父类的prototype属性4、作为对象子类B的原型(__proto__)是父类A,作为构造函数,子类B的原...原创 2018-08-02 11:59:00 · 156 阅读 · 0 评论 -
ES6--修饰器
本篇文章转载自我的个人博客修饰器是一个函数,用来修改类的行为@testableclass MyTestable{ constructor() { super(); }}function testable(target) { target.isTestable = true;}MyTestable.isTestable; //true...原创 2018-08-02 13:12:32 · 760 阅读 · 0 评论 -
ES6--Module
本篇文章转载自我的个人博客exportexport命令可以输出变量、类、函数export输出变量就是本来的名字,但可以通过as关键字重命名export命令规定对外接口,必须与模块内部变量一一建立连接对应关系//报错export 1;//报错var m = 1;export m;//报错function f() {}export f;//正确export v...原创 2018-08-02 13:17:12 · 189 阅读 · 0 评论 -
JavaScript加载
本篇文章转载自我的个人博客传统js加载方式<script src="path/to/myModule.js"></script><script src="path/to/myModule.js" defer></script><script src="path/to/myModule.js" async&原创 2018-08-02 13:19:13 · 309 阅读 · 0 评论 -
阿里笔试题
本篇文章转载自我的个人博客题目 ajaxArray是一个异步请求数组,完成mergePromise函数达到以下输出,并返回一个Promise对象const ajax1 = () => timeout(2000).then(() => { console.log('1') return 1 })const ajax2 = () =>...原创 2018-08-03 10:45:09 · 351 阅读 · 0 评论