发现一种JavaScript“类的继承”的方法

来源:互联网 发布:为什么mac不能玩lol 编辑:程序博客网 时间:2024/06/05 19:45
function First(a, b) {this.a = a;this.b = b;}var first = new First(1, 2);console.log(first);function Second(c, d) {First.apply(this, [1, 2]);this.c = c;this.d = d;}var second = new Second(3, 4);console.log(second);

0 0