Skip to content

Instantly share code, notes, and snippets.

@ldco2016
Created April 30, 2018 21:15
Show Gist options
  • Save ldco2016/c0c583020eab73903a3d18bc5269cac8 to your computer and use it in GitHub Desktop.
Save ldco2016/c0c583020eab73903a3d18bc5269cac8 to your computer and use it in GitHub Desktop.
seating capacity JS
set seatingCapacity(newCapacity) {
if (typeof newCapacity === 'number') {
this._seatingCapacity = newCapacity;
console.log(`${newCapacity} is valid input.`);
} else {
console.log(`Change ${newCapacity} to a number.`)
}
}
}
@ldco2016
Copy link
Author

ldco2016 commented Apr 30, 2018

let restaurant = {
  _name: 'Italian Bistro',
  _seatingCapacity: 120,
  _hasDineInSpecial: true,
  _entrees: ['Penne alla Bolognese', 'Chicken Cacciatore', 'Linguine pesto'],

  set seatingCapacity(newCapacity) {
      if (typeof newCapacity === 'number') {
        this._seatingCapacity = newCapacity;
      console.log(`${newCapacity} is valid input.`);
    } else {
        console.log(`Change ${newCapacity} to a number.`)
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment