JSFiddle - React, Tailwind, and code Playground
by Alex Azuero
JavaScript
var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777-7777",
email: "[email protected]"
};
var mary = {
firstName: "Mary",
lastName: "Johnson",
phoneNumber: "(650) 888-8888",
email: "[email protected]"
};
var contacts = [bob, mary];
function printPerson(person) {
//console.log(person.firstName + " " + person.lastName);
alert(person.firstName);
};
var list =function (){
//var contactLength = contacts.length;
//alert(contactLength);
for(var i = 0; i < contacts.length; i++) // LINE
{
alert([i]);
printPerson(contacts[i]);
}
};
list()