JSFiddle - React, Tailwind, and code Playground

JavaScript

var foo = [ 
   {
      firstName : 'John',
      lastName : 'Doe',
      get fullName(){ return this.firstName +' '+ this.lastName; }
   }]
    

console.log( foo[0].fullName );