JS Main Array Methods Flashcards

1
Q

PUSH

A

.push(condition);
Adds an item to the end of an array
// NOTE: PUSH also returns (shows) the new number of items in the array.

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

POP

A

.pop();
Pop removes the item at the end of an array
NOTE: POP also returns (shows) the value of the item that was removed from the end of the array

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

SHIFT

A

.shift();
(Removes the item at the start of an array (AKA Item at index of Zero). Also, moves all leftover items in the array one space/index to the left)
NOTE: SHIFT also returns (shows) the value of the item that was removed from the start of the array

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

UNSHIFT

A

.unshift(condition);
Adds a new item to the start of an array (AKA at the index of Zero). Also, moves all items in the array one space/index to the right.)
// NOTE: UNSHIFT also returns (shows) the new number of items in the array.

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