Object and property structures

I’ve been trying to structure the menu for this codeacademy project: https://www.codecademy.com/courses/introduction-to-javascript/projects/meal-maker but am running into structure trouble. I’ve checked syntax for getters and setters and also have read quite a few syntax descriptions for objects and properties, mostly at MDN web docs, but still seem to have some errors. I would love some feedback on what I’ve structured and how to improve it. Thanks for your thoughts!

const menu = {
  _courses: {
      appetizers: {
        get getAppetizers(){
          return this.appetizers;
          },
        set changeAppetizers(newAppetizers){
          this.appetizers = newAppetizers;
          }
      }

      mains: {
        get getMains() {
          return this.mains;
          },
        set changeMains(newMains){
          this.mains = newMains;
          }
      }

      desserts: {
        get getDesserts(){
          return this.desserts;
          },
        set changeDesserts(newDesserts){
          this.desserts = newDesserts;
          }
      }

  }

}

Hello @roxanneweber19500773, welcome to the forums! Remember, items in an object must be separated by commas:

const someObj = {
  _someProperty: "hello",//<--notice the comma?
  someOtherProperty: "bye!"
}

Check to see if that’s the case with your code.

ah yes I see it now… thank you!

1 Like