Array.length与Array.prototype.length
问题描述:
我发现Array
对象和Array.prototype
都具有length
属性.我对使用Array.length
属性感到困惑.您如何使用它?
I found that both the Array
Object and Array.prototype
have the length
property. I am confused on using the Array.length
property. How do you use it?
Console.log(Object.getOwnpropertyNames(Array));//As per Internet Explorer
输出:
length,arguments,caller,prototype,isArray,
Prototype
和isArray
可用,但是如何使用length
属性?
Prototype
and isArray
is usable but how do you use the length
property?
答
Array
是构造函数.
所有函数都有一个length
属性,该属性返回函数定义中已声明参数的数量.
All functions have a length
property that returns the number of declared parameters in the function definition.