Array Methods Flashcards

1
Q

Use the correct Array method to remove the last item of the fruits array.

var fruits = [“Banana”, “Orange”, “Apple”];

A

fruits.pop()

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

Use the correct Array method to add “Kiwi” to the fruits array.

var fruits = [“Banana”, “Orange”, “Apple”];

A

fruits.push(“Kiwi”);

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

Use the splice() method to remove “Orange” and “Apple” from fruits.

var fruits = [“Banana”, “Orange”, “Apple”, “Kiwi”];

A

fruits.splice(1, 2);

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

Use the correct Array method to sort the fruits array alphabetically.

var fruits = [“Banana”, “Orange”, “Apple”, “Kiwi”];

A

fruits.sort();

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