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

155
Views
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
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!