javascript-arrays Flashcards

1
Q

What are arrays used for?

A

Arrays are used for storing ordered values. The indices have values that start at 0 and increment by 1 as the array stores more values.

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

Describe array literal notation.

A

Array literal notation looks like so: var threeValues = [1, 2, 3];

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

How are arrays different from “plain” objects?

A

Arrays are different from “plain” objects in the fact that they are a specific type of object. All array key values are numbers, starting with 0 as the first key and increasing by one for each subsequent key.

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

What number represents the first index of an array?

A

The number that represents the first index of an array is 0.

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

What is the length property of an array?

A

The length property of an array carries the value of the number of items in an array.

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

How do you calculate the last index of an array?

A

To calculate the last index of an array do this notation: arr[arr.length-1];

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