constructor属性返回对创建此对象的数组函数的引用。
语法:object.constructor
<script type="text/javascript">
var test=new Array();
if(test.constructor==Array)
{
document.write("this is an array");
}
if(test.constructor==Boolen)
{
document.write("this is a Boolen");
}
if(test.constructor==String)
{
document.write("this is a string");
}
</script>
输出:
This is an Array