10. Another Way to create


#1

What am I missing here ?

https://www.codecademy.com/en/courses/spencer-sandbox/1/5?curriculum_id=506324b3a7dffd00020bf661

Make sure susan1 and susan2 have the same name property

// Our bob object again, but made using a constructor this time 
var bob = new Object();
bob.name = "Bob Smith";
bob.age = 30;
// Here is susan1, in literal notation
var susan1 = {
  name: "Susan Jordan",
  age: 24
};
// Make a new susan2 object, using a constructor instead
var susan2 = Object();
susan2.age = 21;
susan2.name = "Susan Jordaan";

#2

Hi this line

var susan2 = Object();

it's missing the new key before Object();


#3

thanks but it still give me the same message


#4

this line

susan2.name = "Susan Jordaan";

you wrote Jordaan instead of Jordan


#5

Silly me..Thanks a Million !


:smile:


#6

what about this one
"There is a problem with your syntax"
~~~~~
// help us make snoopy using literal notation
// Remember snoopy is a "beagle" and is 10 years old.
var snoopy ={
species:"beagle"
age: 10
};

// help make buddy using constructor notation
// buddy is a "golden retriever" and is 5 years old
var buddy = new Object();
buddy.age = 5;
buddy.species = "golden retriever";

~~~~~


#7

in this object its missing the , after the key/value

var snoopy ={
    species:"beagle" , <-- //add one here ,
    age: 10
};

#8

thanx again. really appreciate it.


#10

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