Arrays Flashcards

1
Q

How do you create an array?

A

var bucketList = [‘Web Developer’, ‘Girlfriend’, ‘Dog’];

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

If I have a list using an array with what number, would I select the last string, with a list of three strings?

A

[2]

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

How can you find out how many items are inside of an array?

A

console.log(bucketList.length);

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

With a built in function that Javascript has for arrays, how can we add items to the end of an array?

A

bucketList.push(‘item 3’, ‘item 4’);

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

With a built in function that Javascript has for arrays, how can we delete the last item from an array?

A

bucket.pop();

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