JS Assignment 11: Intro to Objects
skudeva (12)

Hi everyone,

I am not sure what to do in ex:1 and specifically this line "This variable should be assigned a new object".

https://repl.it/student/submissions/6959613

You are viewing a single comment. View All
Vandesm14 (509)

The link you provided doesn't work for other people. Can you paste the code into a regular repl instead?

skudeva (12)

@Vandesm14
Would that help?

function exerciseOne(){
// Exercise One: In this exercise you will create a variable called 'aboutMe'
// This variable should be assigned a new object
// In this object create three key:value pairs
// The keys should be: 'name', 'city', 'favoriteAnimal'
// The values should be strings associated with the keys.
// return the variable 'aboutMe'
}
let aboutMe = [];
let about ={
name:'Stef',
city:'LA',
favouriteAnimal:'Bunny',
};
console.log(about);

malvoliothegood (146)

@skudeva
Your code:

let aboutMe = [];
let about ={
    name:'Stef',
    city:'LA',
    favouriteAnimal:'Bunny',
};

The instructions say to assign aboutMe to the object. You have assigned about. You can leave out the comma after city: 'LA'. Also, the convention is to use more spaces in your syntax. Below is an example:

let studentA = {
    name: 'Mary White',
    class: 'Level 1 English',
    finalGrade: 'A+'
};
console.log("Student", studentA.name, "got a final grade of", studentA.finalGrade);