JavaScript Arrays Flashcards
True or False: You can change the contents of a const array
True
True or False: You cannot reassign a new array of different value
True
How do you return the number of items in an array?
.length
What does the .push() method do?
It’s a built-in JavaScript method that can add items to the end of an array
True or False: using the .push() method will change the original array
True
What does the .pop() method do?
Removes the last item of an array
True or False: using the .pop() method will change the original array
True
what does the .shift() method do?
Removes the first element from an array
what does the .unshift() method do?
Adds one ore more elements to the beginning of an array
what does the .slice() method do?
grabs a specified portion of your array. The original array will not be modified.
what does the .indexOf() method do?
returns the first index at which a given element can be found in the array. Or, -1 if element is not found