JavaScript Arrays Flashcards

1
Q

True or False: You can change the contents of a const array

A

True

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

True or False: You cannot reassign a new array of different value

A

True

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

How do you return the number of items in an array?

A

.length

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

What does the .push() method do?

A

It’s a built-in JavaScript method that can add items to the end of an array

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

True or False: using the .push() method will change the original array

A

True

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

What does the .pop() method do?

A

Removes the last item of an array

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

True or False: using the .pop() method will change the original array

A

True

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

what does the .shift() method do?

A

Removes the first element from an array

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

what does the .unshift() method do?

A

Adds one ore more elements to the beginning of an array

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

what does the .slice() method do?

A

grabs a specified portion of your array. The original array will not be modified.

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

what does the .indexOf() method do?

A

returns the first index at which a given element can be found in the array. Or, -1 if element is not found

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