Where to Define Getter Methods in JavaScript

https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-ii/modules/fecp-learn-javascript-syntax-objects/projects/meal-maker

The hint and the help video say to define the getters and setters for the properties outside of the object where they’re defined:

const menu = {
  _courses: {
    appetizers: [],
    ...,
  },
  get appetizers() {
 
  }

That doesn’t make sense. Shouldn’t they be in the same object of the properties they’re for?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.