<script type="text/javascript">
function Foo(name){
this.name=name
}
function Bar(){}
Foo.prototype.name="python"
Foo.prototype.say=function(){
return this.name
}
Bar.prototype=new Foo();
var b1 = new Bar();
var f1 = new Foo("php");
delete f1.name;
console.log(b1.say())//undefined
console.log(f1.say())//python
</script>
百度-前端面试题
最新推荐文章于 2023-03-12 18:59:02 发布