4. add prop. (dots question)



Can i write like that with a lot of dots? It lets me move to next challenge, but feels wierd, just curious.

var friends = {};

    friends.bill = {};
        friends.bill.firstName = "Bill",
        friends.bill.lastName = "Gates",
        friends.bill.number = "345"

    friends.steve = {
       firstName: "Steve",
       lastName: "Jobs",
       number: "123"


This way is fine except it is a statement, so ends with ;, not ,. The object literal is easier to read, and write. We can nest the ojbects, as well, to make it even more explicit:

var friends = {
    steve: {},
    bill: {}


Oh yes ofcourse semicolons. Ye, i agree about object literal way, i wrote that just for training. Thanks :grin: