function getter() { return this.firstname + ' ' + this.lastname; } users.forEach(function(user) { Object.defineProperty(user, 'fullname', { get: getter }); });