Where to Define Getter Methods in JavaScript


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.