Arrays: adding and removing elements Flashcards

1
Q

var finalScores = ____

A

[];

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

counties is an empty array. What is the value of counties[0]?

A

undefined

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

What keyword removes the last element from an array?

A

pop

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

What keyword adds one or more elements to the end of an array?

A

push

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

Assign the number 1 to the 10th element of the array nums.

A

nums[9] = 1;

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

Remove the last element from the array pets.

A

pets.pop();

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

Create an empty array.

A

var airlines = [];

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

Change the value of the first element of an array to a new string.

A

names[0] = “Ted”;

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

Add a new element, a number, to the end of an array.

A

prices.push(99);

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

Assign string values to the second and fourth elements of an array.

A
names[1] = "Sue";
names[3] = "Kate";
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

add three number elements to end of an array.

A

prices.push(59, 79, 99);

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

Assign the number 1 to the 10th element of the array nums.

A

nums[9] = 1;

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