日期:2014-05-16 浏览次数:20518 次
<script type= "text/javascript">
function circle(x, y, r) {
this.x = x;
this.y = y;
this.r = r;
}
if (circle.prototype == null){
alert("NULL");
} else {
//结果输出NOT NULL
alert("NOT NULL"); //circle是Function的实例,Function的实例是带prototype的
if (circle.prototype == Object) {
alert("SAME TO OBJECT");
} else {
//结果输出DIRRERENT
//prototype貌似继承了Object.prototype,不过继承不代表===吧?
//证明继承的方法很简单delete circle.prototype.constructor;后在alert(circle.prototype.constructor)就会指向Object
alert("DIFFERENT TO OBJECT");
}
if(circle.prototype == Object.prototype){
alert( "SAME TO OBJECT 'S PROTOTYPE ");
}else{
//结果输出DIRRERENT
//这里不解释了。。。看上面的解释就知道了。。。
alert( "DIFFERENT TO OBJECT 'S PROTOTYPE");
}
}
</script>