JS 4.4 Arrays Flashcards
Define ( Arrays )
Arrays are generally describe as “list-like” single objects that contain multiple values stored in a list.
How does multidimensional arrays work?
By chaining two square brackets together, the first bracket will select the array and the second will be used to select the index desired
Define the .push() method
This method adds one or more values to the end of an Array and RETURNS the new length
Define the .unshift() method
This method adds one or more values to the beginning of an array and RETURNS the new length
What does this ( .length) property return to us when used on an variable containing an Array?
The amount of ‘items’ stored within the Array
Define the .pop() method
This method removes the LAST element from the end of the list and returns the new length
Define the .shift() method
This method removes the FIRST element from the end of the list and returns the new length
The pop & shift method doesn’t just remove the last and first element it also ___
Returns the last element or first element
Define the ( Spread ) syntax and use
The spread syntax ( … ) allows an iterable such as an array expression or string to be expanded in places where zero or more arguments or elements are expected.
Define the Math.max( ) and Math.min( ) functions
These functions return the largest or smallest of the zero or more numbers given as input parameters, or NaN if any parameter isn’t a number and can’t be converted into one. *HAS TO BE A NUMBER VALUE or spread.
Define the ( join( ) ) method
The join( ) method creates and returns a new string by concatenating all of the elements in an array
Define the ( includes( ) ) method
The includes( ) method determines whether an array includes a certain value among its entries, returning TRUE or FALSE
Define the ( indexOf( ) ) method
The indexOf( ) method returns the first index at which a given element can be found in the array, or -1 if it is not present