Editing an existing object..help needed



I'm not sure why this appears: "Did you give your interests key an array value?"

var myObject = {
  name: 'Eduardo',
  type: 'Most excellent',
  interests: 'Something'
var myArray= [4, 3, true, myObject];

> "Did you give your interests key an array value?"


myArray[3] represents 3rd item which is myObject (which is an object).
to access interests (it is object's key) value from myObject we write something like this...

Do you get the hint?
I hope it helps! :slight_smile:
do reply if it solved your problem or not!

The above thing is not relevant !

Update !! I just read the problem which says...

Add a key called interests to myObject. Give this key an array value (the array can contain whatever you like).

myObject should have a key named interests and corresponding to this key ,we have to put an array as value!

suppose I want to add an array to an Object in this example...

x = {}
x.hobbies = ["coding" ,"food" , "music"]

then the final object will look like this..

x = {hobbies: ["coding" ,"food" , "music"]}

I hope it helps!!


Thanks!! Im a bit confused...."interests" is a key to myObject and 'Something' is its value. Im not sure what I'm doing wrong :confused:


ok this seem clear, I will try this....will let you know my results. thanks!


Sure!! :slight_smile:


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