September 2024
Beginner to intermediate
985 pages
35h 37m
English
You got to know arrays briefly in Chapter 3. Nevertheless, at this point we’ll first give you a brief recap of how to create and initialize arrays.
In JavaScript, arrays can be created in two different ways: via a constructor function and via the short notation shown in the previous chapter, the array literal notation. Using the array constructor function, an array is created as shown in Listing 4.47.
const names = new Array();
Listing 4.47 Creating an Array
If you know a priori the number of values to be stored in the array, you can also pass this number to the constructor function as an argument as shown in Listing 4.48 (though you don't necessarily have to as arrays ...
Read now
Unlock full access