Social Icons

Pages

Tuesday, November 29, 2016

Building an Address Book 1/6

Digitizing People
Meet Bob. Bob is our friend. But how do we get in touch with Bob?
Look at the code in the editor. We have Bob's information stored in an associative arraynamed bob. bob has a property calledfirstName which has a value of "Bob". Similarly, it has properties lastName,phoneNumber and email which each have values.
To access the values for each property we write array.property. Check out line 8 where we log to the console bob.firstName.


Instructions
Copying the format we used on line 8, fill inlines 9 and 10 so that Bob's lastName and email are printed out.
?
Hint
To access the value of a property, we writearray.property. So to get Bob's phone number, we'd write bob.phoneNumber


                                                                       var bob = {
                                                                       firstName: "Bob",
                                                                       lastName: "Jones",
                                                                       phoneNumber: "(081) 777-777",
                                                                       email: "hh.jones@example.com"
                                                                            };

                                                                       console.log(bob.firstName);
                                                                       console.log(bob.lastName);
                                                                       console.log(bob.email);












No comments:

Post a Comment