How can I do this?


#1

var myOwnObject={
'myOwnObject.name': "Well done!",
'myOwnObject.age': "Kevin"
};
var myOwnArray=["Let's move on, shall we?", myOwnObject];
console.log(myOwnArray);

That's my code and I don't want to appear (myOwnObject.name &age) but if I remove > ('__') this won't work anymore! I am confused!!!!


#2

if you remove this ' ' in the forum or lesson ?


#3

if I remove that ....myOwnObject won't work anymore :sob:


#4

You appear to be trying to use dot notation in literal notation.
Remember literal notation syntax looks like
var literalObject = {
property: something,
property: something,
property:something
};

And dot notation syntax looks like
var dotObject = new Object();
dotObject.property = something;
dotObject.property = something;
dotObject.property = something;

however, if you corrected your object, your output would look like
Let's move on, shall we?', { name: 'Well done!', age: 'Kevin' }

would be slightly more complicated to get your output to be "Let's move on, shall we? Well done! Kevin"

(hint hint, array[postion].objectproperty)