var a = {
x : 1,
y : 2,
add : function () {
return this.x + this.y;
},
mul : function () {
return this.x * this.y;
}
}
function A(x, y) {
this.x = x;
this.y = y;
this.add = function () {
return this.x + this.y;
}
this.mul = function () {
return this.x * this.y;
}
}
a = new A(1, 2);
function A(x, y) {
this.x = x;
this.y = y;
this.add = function () {
return this.x + this.y;
}
this.mul = function () {
return this.x * this.y;
}
}
function B(x,y){
}
B.prototype=new A(1,2);
console.log(new B(3,4).add()); //3
function A() {
}
A.prototype = {
x : 1,
y : 2,
add : function () {
return this.x + this.y;
},
mul : function () {
return this.x * this.y;
}
}
A.prototype.constructor=A;
function B(){
}
B.prototype=A.prototype;
B.prototype.constructor=B;
b=new B();
console.log(b.add()); //3
function A(x, y) {
this.x = x;
this.y = y;
this.add = function () {
return this.x + this.y;
}
this.mul = function () {
return this.x * this.y;
}
}
function B(x, y, z) {
A.apply(this, arguments);
this.z = z;
}
console.log(new B(1,2,3));
function IA(){
this.walk=function(){
console.log("walk");
}
}
function IB(){
this.run=function(){
console.log("run");
}
}
function Person(){
IA.apply(this);
IB.apply(this);
}
var p=new Person();
p.walk(); //walk
p.run(); //run
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有