array
variables, we can store several pieces of data in one place.
You start an array declaration with an opening square bracket, end it with a closing square bracket, and put a comma between each entry, like this:
var sandwich = ["peanut butter", "jelly", "bread"]
.
myArray
so that it contains both a string
and a number
(in that order).
HintmyArray
should be an array
.
testString: 'assert(typeof myArray == "object", "myArray
should be an array
.");'
- text: The first item in myArray
should be a string
.
testString: 'assert(typeof myArray[0] !== "undefined" && typeof myArray[0] == "string", "The first item in myArray
should be a string
.");'
- text: The second item in myArray
should be a number
.
testString: 'assert(typeof myArray[1] !== "undefined" && typeof myArray[1] == "number", "The second item in myArray
should be a number
.");'
```