Array API Flashcards

Memorizing most useful Array methods on JavaScript

1
Q

Returns a new array comprised of this array joined with other array(s) and/or value(s).

A

array.concat(value1, value2, …, valueN)

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

Tests whether all elements in the array pass the test implemented by the provided function.

A

array.every(callback[, thisObject])

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

Creates a new array with all elements that pass the test implemented by the provided function.

A

array.filter(callback[, thisObject])

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

Executes a provided function once per array element.

A

array.forEach(callback[, thisArg])

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

Returns the first index at which a given element can be found in the array, or -1 if it is not present.

A

array.indexOf(searchElement[, fromIndex])

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

Joins all elements of an array into a string.

A

array.join(separator)

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

Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.

A

array.lastIndexOf(searchElement[, fromIndex])

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

Creates a new array with the results of calling a provided function on every element in this array.

A

array.map(callback[, thisArg])

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

Removes the last element from an array and returns that element.

A

array.pop()

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

Mutates an array by appending the given elements and returning the new length of the array.

A

array.push(element1, …, elementN)

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

Reverses an array in place. The first array element becomes the last and the last becomes the first.

A

array.reverse()

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

Removes the first element from an array and returns that element. This method changes the length of the array.

A

array.shift()

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

Returns a one-level deep copy of a portion of an array.

A

array.slice(begin[, end])

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

Sorts the elements of an array in place and returns the array.

A

array.sort([compareFunction])

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

Changes the content of an array, adding new elements while removing old elements.

A

array.splice(index , howMany[, element1[, …[, elementN]]]) array.splice(index[, howMany[, element1[, …[, elementN]]]])

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

Adds one or more elements to the beginning of an array and returns the new length of the array.

A

arrayName.unshift(element1, …, elementN)

17
Q

array.concat(value1, value2, …, valueN)

A

Returns a new array comprised of this array joined with other array(s) and/or value(s).

18
Q

array.every(callback[, thisObject])

A

Tests whether all elements in the array pass the test implemented by the provided function.

19
Q

array.filter(callback[, thisObject])

A

Creates a new array with all elements that pass the test implemented by the provided function.

20
Q

array.forEach(callback[, thisArg])

A

Executes a provided function once per array element.

21
Q

array.indexOf(searchElement[, fromIndex])

A

Returns the first index at which a given element can be found in the array, or -1 if it is not present.

22
Q

array.join(separator)

A

oins all elements of an array into a string.

23
Q

array.lastIndexOf(searchElement[, fromIndex])

A

Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.

24
Q

array.map(callback[, thisArg])

A

Creates a new array with the results of calling a provided function on every element in this array.

25
array.pop()
Removes the last element from an array and returns that element.
26
array.push(element1, ..., elementN)
Mutates an array by appending the given elements and returning the new length of the array.
27
array.reverse()
Reverses an array in place. The first array element becomes the last and the last becomes the first.
28
array.shift()
Removes the first element from an array and returns that element. This method changes the length of the array.
29
array.slice(begin[, end])
Returns a one-level deep copy of a portion of an array.
30
array.sort([compareFunction])
Sorts the elements of an array in place and returns the array.
31
array.splice(index , howMany[, element1[, ...[, elementN]]]) array.splice(index[, howMany[, element1[, ...[, elementN]]]])
Changes the content of an array, adding new elements while removing old elements.
32
arrayName.unshift(element1, ..., elementN)
Adds one or more elements to the beginning of an array and returns the new length of the array.
33
Method that applies a function against an accumulator and each value of the array transforming it to a single value.
array.reduce(callback[, initialValue]) callback -\> function(previousValue, currentValue, index, array){}
34
array.reduce(callback[, initialValue]) callback -\> function(previousValue, currentValue, index, array){}
Method that applies a function against an accumulator and each value of the array transforming it to a single value.