2021-08-28

Using one object value in another value on the same object Javascript [duplicate]

My question is somewhat simple, but IDK if I haven't made the search with the right keywords, but my problem is:

When defining an object in JS/TS, how can I use one value from the obj into another key, something like:

const person = {
  firstName: 'RĂ©gis',
  middleName: 'Faria',
  fullName: `${firstName + middleName}` // Here is where IDK how to do it. I've tried with 'this.' but no success
}

Hope someone can help me out. Thanks in advance!!



from Recent Questions - Stack Overflow https://ift.tt/2Wvu0dU
https://ift.tt/eA8V8J

No comments:

Post a Comment