![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ES6
zhy前端攻城狮
个人博客:http://zhanghongyublog.com
展开
-
ES6基础之Class基本语法
在JS中,生成实例对象的传统方法是通过构造函数,例如:function Point(x,y){ this.x=x; this.y=y; } Point.prototype.toString=function(){ return this.x+' '+this.y; }var p=new Point(1,2); console.log( p.toString() );//1原创 2017-08-14 11:53:22 · 349 阅读 · 0 评论 -
ES6基础之Class的继承
Class的继承 class可以通过extends关键字来实现继承//父类 class Point{ private x; private y; constructor(x,y){ this.x=x; this.y=y; } toString(){ return '('+this.x+','+this.y+')原创 2017-08-16 11:30:56 · 481 阅读 · 0 评论 -
ES6基础之详解Promise基本用法
一、Promise是一个构造函数,用来生成promise实例;var promise=new Promise();二、构造函数接收一个参数,这个参数是一个函数,当创建实例的时候,参数里的函数会立即执行;var promise=new Promise( function(){ console.log('这行代码会立即执行!') } )三、参数里面的函数又接收两个参数,两个参数均为函数,一个resol原创 2017-09-29 11:20:49 · 2826 阅读 · 1 评论