JavaScript Arrays Flashcards

1
Q

What are arrays used for?

A

Arrays are used for storing a list of values, sorted in order and hold numeric value, that are related to each other

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

Describe array literal notation.

A

Declare a variable and the values are separated by commas , and are all within a pair of square brackets []

var Array = [‘String’, ‘2’, ‘False’] (String, Number, Boolean)

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 held in square brackets and do not hold key:value pairs.

Arrays indexes and index values

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

You start counting at 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

array.length will return the length of the array

[one, two, three] has an array.length of 3

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

array.length - 1 will return the last index of the array

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