美文网首页
ES5 中prototype作用

ES5 中prototype作用

作者: adustdu2015 | 来源:发表于2018-04-26 14:55 被阅读0次

    function Obj(){
    this.name ="aaaa";
    this.say = function(){
    console.log('say');
    }
    }
    Obj.prototype.getApp = funcion(){
    return 'App';
    }

    var app = new Obj();
    console.log(app.getApp());

    以上就是创建类以及扩展方法的使用细节.

    相关文章

      网友评论

          本文标题:ES5 中prototype作用

          本文链接:https://www.haomeiwen.com/subject/zrzplftx.html