javascript-arrays Flashcards
What are arrays used for?
They are ordered lists made for dealing with data in an orderly fashion
Describe array literal notation.
square brackets with values separated by commas
How are arrays different from “plain” objects?
arrays have length properties
arrays have a set order
array indexes are called with numbers in [ ]
What number represents the first index of an array?
0
What is the length property of an array?
it returns the number value of the amount of items in an array. it is a true value
How do you calculate the last index of an array?
you calculate the last index of an array by returning the result of
arr.length - 1
How do you calculate the last index of an array?
you calculate the last index of an array by taking the length of an array and subtracting 1
arr.length - 1