Lesson 8: Arrays and Applications Flashcards
What does an Array do?
Stores an ordered list of values under a single name.
Show an example of an empty Array:
let myArray = [ ];
What is an Array Property do?
Returns the number of elements in the array.
Show how to delete a value from an Array:
delete myArray[2];
concat:
Merges elements in multiple arrays and returns the merged result.
toString:
Returns the string of all items in the array.
indexOf:
Returns the index of the first matching item in the array.
lastIndexOf:
Returns the index of the last matching item in the array.
push:
Adds a new value to the end of the array.
pop:
Removes the last item from an array.
Shift:
Removes the first item in the array.
Unshift:
Inserts a new item to the beginning of the array.
What does sort() do?
Sorts an arrays elements alphabetically.
What does reverse() do?
Reserves elements sequence in the array.
What does the forEach method do?
Accepts a function name as an argument.