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

99
Views
how to get to the properties of an object inside of it javascript

I would like to get 'experiments[0].name' but I have error that name is not defined. How to get this property?

let experiments = [ {name: "C200929R01_SizeMarker", file: experiments[0].name + ".xrrx"} ];

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Until that closing ] experiments indeed won't be defined.

If your just trying to save typing the name in twice, you could retructure like ->

const name = "C200929R01_SizeMarker";
let experiments = [ {name, file: name + ".xrrx"} ];

console.log(experiments);

about 4 years ago · Juan Pablo Isaza Report

0

let experiments = [ {name: "C200929R01_SizeMarker", file: experiments[0].name + ".xrrx"} ];

When you are asigning file: experiments[0].name, experiments[0] is not defined yet, so you have different options:

let experiments = [{name: "C200929R01_SizeMarker"}];
experiments[0].file = experiments[0].name + ".xrrx";

Or using the option described in the previous answer

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!