Let's see how pseudo-arrays are similar to regular arrays.
Indices
The elements of a pseudo-array, like the elements of a regular array, can be accessed by their index:
console.log(elems[0]);
console.log(elems[1]);
console.log(elems[2]);
Length
You can also find out the number of
elements using the length
property:
console.log(elems.length);
Loop
It is possible to loop through the elements of a pseudo-array:
for (let elem of elems) {
console.log(elem);
}
Practical tasks
Paragraphs are given:
let elems = document.querySelectorAll('p');
Check for the variable elems
the described possibilities of
pseudo-arrays.