Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
How do I get values from an object using dot notation

How do I get values from an object using dot notation when I have a variable that changes.

console.log(`${getData}.BUTTON_${item.UUID}`);
// outputs: [object Object].BUTTON_1 

In the object is a value for BUTTON_1. My item.UUID is a number that will change to a different button number. I need to be able to get the value for the button number

what works

console.log(getData.BUTTON_0);

My button number will be between 0 and 4 example getData.BUTTON_0, getData.BUTTON_1 ...

currently I need the button number to be a variable however the following does not work

console.log(`${getData}.BUTTON_${item.UUID}`);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JavaScript object: access variable property by name as string

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors#bracket_notation

console.log(getData[`BUTTON_${item.UUID}`]);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!