Arrays and Objects


#1

var myObject = {
name : 'Eduardo',
type: 'Most excellent',
interests: ['myInterests'],
}
var myInterests = ["optionOne", "optionTwo", "optionTree", "optionFour"];

I just want to know the code to make the console print the name, Most excellent, and myIntrerests.

or i can't i don't know sorry noob!


#2

If we examine this closely we see that is not a reference as intended. It is a single string primitive as the lone element of an array. What happens if you write it like so?

    interests: myInterests

Once the fix is done, we can test it by logging the object:

console.log(myObject);
// { name: 'Eduardo', type: 'Most excellent', interests: undefined }

Notice what the value for interests is? undefined. Why is that, do you think?


#3

i see thank you so much :grin: