2015-05-29 50 views
1

我踩着通過這個VB.NET/ASP應用程序,當我在一個Javascript功能注意到了這一點好奇:爲什麼在調試過程中myArray.length顯示爲0?

enter image description here

鼠標陣列上,你可以看到有集合中的7個項目。將鼠標移到length屬性上,它說0.爲什麼?

+0

你是如何填充'pVarArray'? – thefourtheye

+0

@thefourtheye'var pVarArray = document.getElementsByTagName(「input」);' – sab669

回答

1

長度()傾向於指連續的元素 - 例如一個字符串的長度。

Count()傾向於指寬鬆集合中元素的數量。

+0

JS中沒有'Count'; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array – sab669

相關問題