Michael Elliott
coding.
@elliotecweb
var emptyArray = [];
var oddNumbers = [1, 3, 5, 7, 9];
var nestedArrays = [[1, "Bob", false], [true, 7, "words"], ["data", 2, 5]];
var names = ["Mike", "Tiffany", "Dave", "Louise"];
names.indexOf("Dave"); // 2
oddNumbers.push(11); // oddNumbers -> [1, 3, 5, 7, 9, 11]
var emptyObject = {};
var car = {make: "Toyota", model: "Prius", color: "Tangerine"};
var cars = [{make: "Toyota", model: "Prius", color: "Tangerine"},
{make: "Subaru", model: "Outback", color: "Forest Green"}]
car.owner = "Mike"; // car -> {make: "Toyota", model: "Prius", color: "Tangerine", owner: "Mike"}
console.log(cars[1].model); // "Outback"
for (i = 0; i <= 10; i++){
console.log(i);
} // -> 1 2 3 4 5 6 7 8 9 10
var names = ["Mike", "Tiffany", "Dave", "Louise"];
for (i = 0; i < names.length; i++){
console.log(names[i]);
} // -> Mike Tiffany Dave Louise
var car = {make: "Toyota", model: "Prius", color: "Tangerine"};
for (key in car){
if (car.hasOwnProperty(key)){
console.log(car[key]);
}
} // -> Toyota Prius Tangerine
@elliotecweb
By Michael Elliott