是否所有的屬性爲.length
的javascript buit-in iterables都可以通過[<numeric index>]
訪問迭代的元素,反之亦然?內置的迭代器:屬性長度和訪問器影響
Array -> has `.length` & has `[]` accessor
String -> has `.length` & has `[]` accessor
TypedArray -> has `.length` & has `[]` accessor
Set -> does not have `.length` & does not have `[]` accessor
Map -> does not have `.length` & does not have `[]` accessor
NodeList -> has `.length` & has `[]` accessor
HTMLCollection -> has `.length` & has `[]` accessor
我不知道是否有其他內置的iterables打破了這個規則。
'NodeList'和'HTMLCollection'沒有JavaScript內建,它們是DOM對象。 – Bergi
好的,謝謝澄清! – xgbuils