javascript-arrays Flashcards
1
Q
What are arrays used for?
A
An array is used to store an ordered list of values.
2
Q
Describe array literal notation.
A
- declare a variable
- use square brackets
- add the values separated by a comma
3
Q
How are arrays different from “plain” objects?
A
- numerically indexed
2. has length property
4
Q
What number represents the first index of an array?
A
0
5
Q
What is the length property of an array?
A
It provides the number of values in the array.
6
Q
How do you calculate the last index of an array?
A
Subtract 1 from the length of the array.