JS Arrays Flashcards

1
Q

What are arrays used for?

A

To store a list of data/values

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

Describe array literal notation.

A

Array literal notation is square brackets [ ]. Within the square brackets, values are nested inside. Each are separated by a comma.

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

How are arrays different from “plain” objects?

A

There is an actual order to it the values of the array. Arrays have indexes.

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

What number represents the first index of an array?

A

0 (zero)

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

What is the length property of an array?

A

The number of indexes in the array — (how many entries are in the array).

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

How do you calculate the last index of an array?

A

array[lastIndex] = array.length - 1

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

What isArray.prototype.filteruseful for?

A

To filter out arrays

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
8
Q

What isArray.prototype.mapuseful for?

A

Every element of array

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

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

What isArray.prototype.reduceuseful for?

A

To reduce an array into a singular value

Executes a reducer function (that you provide) on each element of the array, resulting in a single output value.

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