Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

为什么在js中Array.length ===1, Array.prototype.length === 0都为true

console.log(Array.length); //1
console.log(Array.prototype.length); //0

实在想不通为啥Array.length等于1


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)

Array Contructor 是一个构造函数,并不是数组。

函数的 length 一般指参数的个数。

对 Array ,标准明确规定了它的 length 是 1 。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...