Stuck 12.Practice Makes Perfect


#1

HERE IS MY CODE. KEEP GETTING "Have you defined object2 as an object?"

var object1 = new Object();
object1.key1 = value;
object1['key2'] = value;

var object2 = {
key1: value,
key2: value
};
var object2 = {};
object2.key1 = value;
object2['key2'] = value;

var object3 = new Object();
object3.key1 = value;
object3['key2'] = value;

Replace this line with your code.

`


#2

You have defined it twice. This is likely the cause of the SCT error. Remove the second example of object2.


#3

What lesson and unit are you on? because I don't think this is the Contact List unit. :smile:


#4

Yeah - Don't know How Contact List got there. It is JavaScript 12.
Practice makes Perfect. I gave the code.
Nothing I try works. Any ideas. Why would Contact List have "12"?
Could the indexes have gotten mixed up?


#5

I Clicked on menu at lower left and clicked on "13. Review" so got past the
bad one. I will see if I can get to the end.


#6

"What lesson are you one?" translates to "Please post a link to the exercise." It's a simple matter of copying the URL from the location bar and pasting it in your post.


#7

Okay for one my advice make your code as practical as possible in order to grasp it well for example,

var object1 = Object();
object1.name = "robinlrandall"

I just created an Object using the object constructor and assigned it a value name that's your username.


#8

Sorry, hope this works


#9

I got it to work Thanks. "value" was not defined.


#10

This is correct:

as is this,

and this,

all with one exception. The undefined value variable. Put that in quotes and you have a solution. For practice, you could swap {} in for new Object() on the last one.

Remove this one...

as it overwrites your first one.


#11

I never defined value.

At the top I should have said:
var value = "test"


#12

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