One Pager Cheat Sheet
- We will learn about arrays, their implementation, and
array operations
in JavaScript in this lesson. - Arrays are a
data structure
containingarray elements
with a specificindex
andlength
that allow for easier organization and storage of a collection of data in programming. - Arrays in JavaScript allow multiple elements of different data types, such as strings, numbers, and other arrays, to be stored in a single array, initialized by giving it a name and specifying all elements separated by a comma.
- Arrays in JavaScript can store different data types, including strings, numbers, and other arrays, as long as the syntax is correct.
- Array operations such as
adding
,removing
,searching
, andprinting
can help make programming with arrays much easier. - We can add and remove elements from a JavaScript array using the
.push()
,.pop()
, and.splice()
methods, and access the array length using thelength
property. - The code will add 3 elements to an empty array
cars
using.push()
and then remove one element from the 3rd index with.splice()
, leaving the resultant array as["Ford", "BMW"]
. - The output of the code will be 7, the
third element
in thenumbers
array accessed by itsindex
. - We learned to manipulate and access array properties with various array
operations
that can be used in programming tasks.