Objects


#1

HI,
Here's the code

  var myArray=[45,false,"dj",me];
  var me= newObject();
  me.name="xyz";
  me.age=14;
  console.log(me);

What is wrong in this?`


#2

new Object() is two words, and you should define an object before you can store it in an array


#3

So should I write something in the brackets


#4

no? you have newObject() as one word, it should be two words with a space in between, given they are both keywords

and you should first create your object, before adding it to your array


#5

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