Methods Flashcards
What method can you create an array from array-like or iterable objects?
Array.from()
Describe Filter()?
filter() method creates a new array with all elements that pass the test implemented by the provided function.
Describe pop()?
The pop() method removes the last element from an array and returns that element. This method changes the length of the array.
Describe indexOf()?
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.
Describe spit()?
split() method splits a STRING into an array of strings using a separator that you provide.
Describe includes()
The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.
var array1 = [1, 2, 3];
console.log(array1.includes(2));// expected output: true
var pets = ['cat', 'dog', 'bat'];
console.log(pets.includes('cat'));// expected output: true
console.log(pets.includes('at'));// expected output: false