Pseudo-arrays in JavaScript

In addition to arrays, JavaScript has objects that are similar to arrays, but do not support all of their features. Such objects are called pseudo-arrays.

Pseudo-arrays most often occur when working with DOM elements. Let's look at an example. Let's have paragraphs:

<p></p> <p></p> <p></p> <p></p> <p></p>

Let's get our paragraphs into a variable:

let elems = document.querySelectorAll('p');

The variable elems will contain a pseudo-array:

console.log(elems); // it's a pseudo-array

In the following lessons, we will deal with the features of pseudo-arrays, consider how they are similar to regular arrays, and how they differ.

enru