object-properties
    Preparing search index...

    Function defineGetter

    • Defines a getter property

      Type Parameters

      • T
      • P extends string
      • V

      Parameters

      Returns any

      target

      const person = { firstName: 'John', lastName: 'Doe' };
      defineGetter(person, 'fullName', function() {
      return `${this.firstName} ${this.lastName}`;
      });
      console.log(person.fullName); // 'John Doe'