Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

217
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda