Lesson 8: Arrays and Applications Flashcards

1
Q

What does an Array do?

A

Stores an ordered list of values under a single name.

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

Show an example of an empty Array:

A

let myArray = [ ];

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

What is an Array Property do?

A

Returns the number of elements in the array.

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

Show how to delete a value from an Array:

A

delete myArray[2];

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

concat:

A

Merges elements in multiple arrays and returns the merged result.

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

toString:

A

Returns the string of all items in the array.

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

indexOf:

A

Returns the index of the first matching item in the array.

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

lastIndexOf:

A

Returns the index of the last matching item in the array.

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

push:

A

Adds a new value to the end of the array.

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

pop:

A

Removes the last item from an array.

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

Shift:

A

Removes the first item in the array.

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

Unshift:

A

Inserts a new item to the beginning of the array.

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

What does sort() do?

A

Sorts an arrays elements alphabetically.

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

What does reverse() do?

A

Reserves elements sequence in the array.

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

What does the forEach method do?

A

Accepts a function name as an argument.

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

What is the function parameter also called?

A

A callback function.

17
Q

What is the map() method used for?

A

Returning a new array that replaces each value with the return value of the callback function.

18
Q

What does the Three Dot (…) notation do?

A

It will spread out the elements of that array.

19
Q

Show an example using the Dot Notation:

A
const numArr1 = [20, 30];
const numArr2 = [50, 60];
let numArr3 = [1, ...numArr1, ...numArr2, 80];
20
Q

What is Initializing an Array?

A

Entering preloaded data at the time the array is created.

21
Q

Show an example of an initialized array:

A

var myArray = [‘Monday’, ‘Tuesday’];

22
Q

join():

A

Joins all of an arrays elements into a single string.

23
Q

What is ‘for-of’ used for?

A

Looping through interable structures