Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var bob = {
- firstName: "Bob",
- lastName: "Jones",
- phoneNumber: "(650) 777-7777",
- email: "bob.jones@example.com"
- };
- var mary = {
- firstName: "Mary",
- lastName: "Johnson",
- phoneNumber: "(650) 888-8888",
- email: "mary.johnson@example.com"
- };
- var contacts = [bob, mary, ilya];
- function printPerson(person) {
- console.log(person.firstName + " " + person.lastName);
- }
- function list() {
- for (var i = 0; i < contacts.length; i++) {
- printPerson(contacts[i]);
- }
- }
- var add = function (firstName, lastName, phoneNumber, email) {
- contacts[contacts.length] = {
- firstName: firstName,
- lastName: lastName,
- phoneNumber: phoneNumber,
- email: email
- }
- }
- add("ilya","vlasov","467427","inestacs@gmail.com");
- list();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement