Can you interpolate multiple .this methods in the same string and is the example I provide correct syntax for this method?

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;
    } else {
      console.log(`Change ${newCapacity} to a number.`)

 get seatingCapacity() {
    console.log(`There are ${this._seatingCapacity} seats at ${this._name}.`);
    return this._seatingCapacity;
${this._seatingCapacity} seats at Italian Bistro.` with ${this._name} );

Before the chorus comes out a singing, no this is not perfect syntax. I'm learning.

Here is the exercise:


note that knowing the answer to this will not help me pass the challenge…if I actually know the answer. I am trying to verify if my thinking is correct.


Singing starts…

Those are not methods, but properties.

Yes, you can interpolate whatever you like, there is no limit.

Not sure what this line is about…

Did you mean,

console.log(`${this._seatingCapacity} seats at Italian Bistro. with ${this._name}`);

Not sure I follow what this getter is supposed to be doing. Why is it logging?


I figured it out and got it correct on my own :grin:


Yeah, belay that last question. I see the author used it in his example.


The getter was gonna get the seating capacity and then get the italian bistro instead of just using a string to say italian bistro. No pressure cause I figured it out on my own haha. (a different question obviously but the same exercise).


what do you mean belay?


It’s an old communication phrase,

Belay, belay!

which is piped when one wants the previous message to be ignored.


I finished all the checkmarks for the exercise, but when I console.logged it I got the response: invalid response.

Yet, I still got the checkmark.
Is that a bug in the system?

let person = {
  _name: 'Lu Xun',
  _age: 137,
  set age(ageIn) {
    if (typeof ageIn === 'number') {
      this._age = ageIn;
    else {
      console.log('Invalid input');
      return 'Invalid input';
  get age () {console.log(`${}` + ' is' + `${this.age}` + ' years old.' )}


person.age = 'Thirty-nine';
person.age = 39;

Like I said, I already passed the challenge. Was just curious about what’s going on.


Setters don’t normally return anything since they are internal.


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