JS Array
JS Array
0
1
0
0
1
0
1
1 0
0 1
0 0
1
0
1
0
JS Array 0
1
0
1
{;}
1 0
0
1
0
1
0
1
0
0
Arrays
1
0 is a special type of variable that can hold multiple values in a
0
1 single place. These values can be numbers, strings, objects, or
0 1
1 even other arrays. 0
0 1
1 0
0
0
2 ways to create array 0
1
1 0
0 0
1 - Square Brackets ( [] ) - most common methods 1
0
0
1 1
0 1
- new Array(10) - empty slots uninitialized 0
1
1
1
[]
1
0
0
1
0 1
1
0
new Array() 0
1
1 0
0 0
0 1
1 0
0 0
1 1
0 0
1 1
0 1
.length - returns the length (size) of an array: 0
1
1
1
Index refers to the position of an element within an array.
1
0
0
1
0 1
1 0
0 1
1 0
0 0
0 1
1 0
0 0
1 1
0 0
1 1
0 1
0
1
1
1
1
0
1
0
0
1
0