javascript-arrays Flashcards
What are arrays used for?
Arrays are used for storing ordered values. The indices have values that start at 0 and increment by 1 as the array stores more values.
Describe array literal notation.
Array literal notation looks like so: var threeValues = [1, 2, 3];
How are arrays different from “plain” objects?
Arrays are different from “plain” objects in the fact that they are a specific type of object. All array key values are numbers, starting with 0 as the first key and increasing by one for each subsequent key.
What number represents the first index of an array?
The number that represents the first index of an array is 0.
What is the length property of an array?
The length property of an array carries the value of the number of items in an array.
How do you calculate the last index of an array?
To calculate the last index of an array do this notation: arr[arr.length-1];