首页 > 其他 > 详细

es6学习笔记

时间:2016-12-15 14:48:09      阅读:172      评论:0      收藏:0      [点我收藏+]
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学习笔记

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!