Arrays Flashcards
1
Q
Get the value “Volvo” from the cars array and assign to a variable named x.
var cars = [“Saab”, “Volvo”, “BMW”];
A
let x = cars[1];
2
Q
Change the first item of cars to “Ford”.
var cars = [“Volvo”, “Jeep”, “Mercedes”];
A
cars[0] = “Ford”;
3
Q
Alert the number of items in an array, using the correct Array property.
var cars = [“Volvo”, “Jeep”, “Mercedes”];
A
alert(cars.length);