Contact List debug


#1


https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/4?curriculum_id=506324b3a7dffd00020bf661#


Guys, my code says "Oops, try again. It looks like your friends don't have the firstName property" I've checked and checked and can't figure it out... it may be the dim light :wink:

help me debug this please.


var friends = new Object();

    friends.bill = new Object();
        bill.firstName="Bill";
        bill.lastName="Gates";
        bill.number="(206) 555-555";

    friends.steve = new Object();
        steve.firstName="Steve";
        steve.lastName="Jobs";
        steve.number="(205) 666-666";


#2

You making 3 objects here, when you are supposed to add contacts to one object called friends . You need to do something like this.

var friends = {};

    friends.bill = {
  firstName: "Bill",
  lastName: "Gates",
  number: "(206) 555-5555", }

    friends.steve = {
    firstName: "Steve",
    lastName: "Jobs",
    number: "(205) 666-666", }

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.