Bug in 10 - Another Way to Create?


#1

We are asked to create susan2 using a constructor, but are only allowed to continue if we use literal notation.


#2

Could you show your code please?


#3
// 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 = {
  name: "Susan Jordan",
  age: 24
};

//var susan2 = new Object();
//susan.name = "Susan Jordan";
//susan.age = 24;

I think the commented code is what should have been accepted, but the assignment preferred the version above.


#4

your missing a 2 on your susan. Also try refreshing the page.


#5

Ah that was the problem, thanks a bunch!

Even after clearing my cache and refreshing, the literal notation was still accepting, which I think is a bug.


#6

In the end you create the same object with both notations so the test function could only count how often Object is used in the plain text or something like this. But after adding 2s here:

//susan2.name = "Susan Jordan";
//susan2.age = 24;

you should at least be able to pass.