Nitael
8/17/2019 - 2:09 AM

JS snippets

# self reference in an object literal
var obj = {
  a: 42,
  b: 'meaning of life is ',
  get c() {
    return this.b + this.a;
  }
};

console.log(obj.c);