Methods Flashcards

1
Q

What method can you create an array from array-like or iterable objects?

A

Array.from()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe Filter()?

A

filter() method creates a new array with all elements that pass the test implemented by the provided function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe pop()?

A

The pop() method removes the last element from an array and returns that element. This method changes the length of the array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe indexOf()?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe spit()?

A

split() method splits a STRING into an array of strings using a separator that you provide.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe includes()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly