Array.length
.
A more complex implementation of an array can be seen below. This is known as a multi-dimensional array, or an array that contains other arrays. Notice that this array also contains JavaScript objects, which we will examine very closely in our next section, but for now, all you need to know is that arrays are also capable of storing complex objects.
```js
let complexArray = [
[
{
one: 1,
two: 2
},
{
three: 3,
four: 4
}
],
[
{
a: "a",
b: "b"
},
{
c: "c",
d: "d"
}
]
];
```
yourArray
. Complete the statement by assigning an array of at least 5 elements in length to the yourArray
variable. Your array should contain at least one string, one number, and one boolean.
yourArray
should be an array.
testString: assert.strictEqual(Array.isArray(yourArray), true);
- text: yourArray
should be at least 5 elements long.
testString: assert.isAtLeast(yourArray.length, 5);
- text: yourArray
should contain at least one boolean
.
testString: assert(yourArray.filter( el => typeof el === 'boolean').length >= 1);
- text: yourArray
should contain at least one number
.
testString: assert(yourArray.filter( el => typeof el === 'number').length >= 1);
- text: yourArray
should contain at least one string
.
testString: assert(yourArray.filter( el => typeof el === 'string').length >= 1);
```