2. More people, help pls


#1

This is my code:

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"
};

new Array = contacts [bob, mary];
console.log(contacts[1].phoneNumber);

When i submit it this comes up: "Oops, try again. Did you remember to create an object called mary?"

Wich i am pretty sure i did. i also get a error in the console that says: "ReferenceError: Invalid left-hand side in assignment".** **Please help me find out what is wrong.****


#2

@neseballe,
You can not use
new Array = contacts [bob, mary];

You should do

var contacts = [bob,mary];

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array


#3

Thank you Leon for helping my out again :slightly_smiling:


#4

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];
console.log(contacts[1].phoneNumber);