Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
menu

Pseudarray

Pseudarray is an object that is similar to an array. It has numeric properties, like arrays. And also the length property.

It is most often encountered when working with the DOM - all properties and methods that return multiple elements usually return a pseudarray. For example, the property children returns a pseudarray of child elements.

Although pseudarrays are similar to arrays, they are still ordinary objects. They do not have the properties and methods of arrays, such as forEach, join, slice, etc.

Example

Pseudarrays do not have array methods. Therefore, the following code will throw an error:

let children = document.body.children; console.log(children.push());

Example

Since pseudarrays have numeric properties and length, they can be iterated over in a loop. In this example, let's output all child elements:

let children = document.documentElement.children; for (let i = 0; i < children.length; i++) { console.log(children[i]); }
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline