Creating a new object


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-9Sgpi/2/3?curriculum_id=506324b3a7dffd00020bf661#


Oops, try again. Make sure to set your age key to a number representing your age, like this: age: 26


var myObj = new Object();
myObj["name"] = "Jesper";
myObj["age"] = "33";

// what am i doing wrong? thank you in advance.//


#2

age value should be of type integer, not string


#3

The age should be an int, not a string. Simply remove the quote marks around 33.


#4

Thank you for your response, but it did not work. the problem remains the same after i removed the quote marks.


#5

can we see an updated version of your code?

the object should be named me, you named the object myObj


#6

Changing "myObj" to "me" solved my problem:

var me = new Object();
me["name"] = "Jesper";
me["age"] = 33;

Thank you very much for the help guys. Much appreciated. :slight_smile:


#7