16/17 Editing an existing object

I don’t understand what it says…

2 Likes

There is an already created object in the editor, you just need to add a property whose name is “interests” and it must contain an array which is made with square brackets.

2 Likes

All you got to do is create an array called myInterests and list things that you like.

var myInterests = ["optionOne", "optionTwo", "optionTree", "optionFour"];

Now write myInterests into myObject.

interests : myInterests

Then console.log() it!

8 Likes

var arra = [ 2,32,44];

var myObject = {
name: ‘Eduardo’,
type: ‘Most excellent’,
// Add your code here!
interests: arra
};

5 Likes

Thanks Everyone :-)+1:

1 Like

no prob blog hehehheheehehehe get it if not… Sigh corny welcome :yum:

1 Like

Thank you! I understood what I had to do, but I wasn’t clear on exactly HOW they wanted me to write it. I added it inside the object, outside of it, etc. and it was valid, just not what the checker wanted. I didn’t know we had to create the array first and just reference it. Cheers!

3 Likes

Thanks. stuck in this one, i didn’t know that i had to create an array… for interests key.

1 Like

thx @scriptdolphin & @may101

I got this completely wrong haha.

*…poor lad tis a shame…they say e’s a bit dim…

still at least ‘e tries…n… tries…n… well. yeah, e’ just … tries…*

i can see now why they named 'im tim! …

1 Like

I made it in another way and it is also works:

var myObject = {
name: ‘Eduardo’,
type: ‘Most excellent’,
// Add your code here!
interests: [‘cars’, ‘horses’, ‘yachts’]
};

6 Likes

Thanks a lot :slight_smile:

Try this, You put your array into Object

`//Declare Array for the key
var WebProgramming = [[“C++”,“Php”],[“Java Script”]];

//Declare An Object
var myObject = {
name: ‘Eduardo’,
type: ‘Most excellent’,
// Add your code here!
interests: WebProgramming,
};

`

hi ,why interests: WebProgramming,
instead of interests: “WebProgramming”?
thanks

1 Like