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

157
Vistas
Javascript optional chaining on dynamic path

Is there a way to perform Javascript optional chaining on dynamic path.

say I have, a dynamicPath = 'information.person.names.first_name'

If the path was known, I could have done data?.information?.person?.names?.first_name

I have searched and found out that if we have a single path, say dynamicPath = 'first_name' We can easily do data?.[dynamicPath] and get the value.

Can we have some way of doing data?.[dynamicPath] or something similar with the entire path of the object? If the value is 'information.person.names.first_name' then JS would treat the entire string as a key and value would be undefined.

I know we can achieve this with lodash _.get method but we are trying to avoid its use.

about 4 years ago · Juan Pablo Isaza
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