<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
function A(){
this.say=function(){
console.log("我是1");
}
}
function B(){
this.say=function(){
console.log("我是2");
}
}
var a=new A();
var b=new B();
a.say.call(b);
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
function A(){
this.name='SB';
this.say=function(){
console.log("我是1");
}
}
function B(){
A.call(this);
this.say=function(){
console.log("我是2");
}
}
var a=new A();
var b=new B();
console.log(b.name);
b.say();
a.say.call(b);
</script>
</head>
<body>
</body>
</html>