JS Assignment 11: Intro to Objects
jjaime12 (1)

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'
const aboutMe = {
name: 'jose',

city: 'bell gardens',

favoriteAnimal: 'lion',


stuck on this please help

You are viewing a single comment. View All
vedprad1 (860)

Three simple mistakes.

  1. There should be no comma after the last key value pair in the object. Remove it.
  2. You need to move the closing bracket of the function at line 1 all the way to the very bottom of the code. The code needs to be inside, the function, after all.
  3. The last line of the function should be: return aboutMe;. Add it.

The final product:

function exerciseOne() {
  const aboutMe = {
    name: 'jose',
    city: 'bell gardens',
    favoriteAnimal: 'lion'
  return aboutMe;

If this answers your question, please check the checkmark on the left side of this message. Thanks and Good Luck!

TimBogdanov (2)

@vedprad1 quick question, why would you return aboutMe in the object and not in the variable?

vedprad1 (860)

@TimBogdanov : I don't understand your question. aboutMe is the object. You return it an the end of the function so when you call the function later, you can receive the object.