码迷,mamicode.com
首页 > 其他好文 > 详细

es6学习笔记

时间:2016-12-15 14:48:11      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:comment   his   xtend   hello   ret   原型   class   ati   code   

class Point {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
    static classMethod() {
        console.log(‘fathor jt:hello‘);
    }
}
class ColorPoint extends Point { //mix(Cons1,Cons2)
    constructor(x, y, color) {
        super(x, y);
        this.color = color; // 正确
    }
    //原型方法
    ptMethod(){
        console.log(‘pt:hello‘);
    }
    static classMethod() {
        //静态方法也是可以从super对象上调用
        super.classMethod();
        console.log(‘jt:hello‘);
    }
    get prop() {
        return ‘getter‘;
    }
    set prop(value) {
        console.log(‘setter: ‘+value);
    }
}

es6学习笔记

标签:comment   his   xtend   hello   ret   原型   class   ati   code   

原文地址:http://www.cnblogs.com/feixuan/p/6182830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!