Dont know why this wont work please help


#1

var top = [1,3,8];
var myObject = {
name: 'Eduardo',
type: 'Most excellent',
// Add your code here!
interests: top
};
what am I doing wrong here guys?


#2

@boreddaily2015,
A
console.log( myObject );
would show

 { name: 'Eduardo', type: 'Most excellent', interests: [ 1, 3, 8 ] }

Did you get an "Oops ..." message, or something else.....??

[ nice to know ]

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#3

yes i got an oops message
Oops, try again. Did you give your interests key an array value?
I don't understand why when i place the word top why this doesn't equal the value needed.

I don't really understand what you mean in the reset of session area. What do you mean shoot my browser? I tried it again after hitting f5 but its the same. it wont take my top array it self only an array with numbers. but my var top array is global so I don't know why it wouldn't work. hmmmm.....?


#4

@boreddaily2015,
The test done by the code-checker

//if (error) {  
//    return "Your code doesn't look quite right. "+
//    "Use the existing object keys/values as a guide! "+
//    "And check the error message for more information: " + error;
    
//}
if (myObject.interests === undefined) {
    //return
    console.log("Did you create a key called interests for myObject?");
}

if (!(myObject.interests instanceof Array)) {
    //return 
    console.log("Did you give your interests key an array value?");
}

if(myObject.interests.length === 0) {
    //return
    console.log("Your myObject.interests array is empty! \n"+
    "You must have SOME interests.");
}
/*
return true;
","pro_ad":{"params":{"header":"Put your skills into action","body":
"Learn how to apply what you're learning to build real apps with Pro.",
"hint":"Want to translate the skills you're learning into real projects? 
Go Pro.","utm_content":"skillsrealworld",
"image_url":
"https://s3.amazonaws.com/codecademy-images/pro/variants-projects.svg",
"utm_campaign":"ad_narrative_testing_nov_2015",
"utm_source":"codecademy_platform"},"url":"/pro/offer"},"completed":true
*/