JS arrays Flashcards
1
Q
What are arrays used for?
A
they are used when working with a list of values related to each other
2
Q
Describe array literal notation
A
var array = [string, boolean, function, objects, number]
3
Q
How are arrays different from “plain” objects?
A
arrays are in an ordered collection, and each item in the array is accessed thru its index
4
Q
What number represents the first index of an array?
A
zero
5
Q
What is the length property of an array?
A
returns the number of elements in an array
6
Q
How do you calculate the last index of an array?
A
lastIndex = array.length - 1