javascript中constructor属性用来引用初始化该对象的构造函数:示例:
<script language="javascript" type="text/javascript">
//constructor属性用来引用初始化该对象的构造函数
function Bus(price,type){
this.price = price;
this.type = type;
}
var bus = new Bus(10000,"small");
document.write("输出结果:"+bus.constructor);
//判断bus是否为实例
if (typeof bus == "object" && bus.constructor == Bus)
{
alert("bus为Bus的一个实例");
}
</script>