79228844

Date: 2024-11-27 03:18:36
Score: 1
Natty:
Report link

This should be easy and simple. Just use a getter.

var pizzaOrder = {
    id: "pizza",
    counter: 0,
    get sentence() {
       return this.id + this.counter;
    } 
};

pizzaOrder.counter++;

console.log(pizzaOrder.sentence);

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: 010ender