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

154
Views
Retrieve the value from a 3D array

Let say I have a 3D array like this

[
  [
    [3.12234, 50.12322],
    [3.12332, 12.12323],
    [3.431232, 122.22317],
  ],
]

How should i code to get any one of the value in this array?

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

0

1) You can use array indexing as:

const arr = [
  [
    [3.12234, 50.12322],
    [3.12332, 12.12323],
    [3.431232, 122.22317],
  ],
];

const valueUsingMethod1 = arr[0][0];
console.log(valueUsingMethod1);

2) You can also use array-destructuring as

const arr = [
  [
    [3.12234, 50.12322],
    [3.12332, 12.12323],
    [3.431232, 122.22317],
  ],
];

const [[valueUsingMethod2]] = arr;
console.log(valueUsingMethod2);

3) You can also use flat here

const arr = [
  [
    [3.12234, 50.12322],
    [3.12332, 12.12323],
    [3.431232, 122.22317],
  ],
];

const [firstValue] = arr.flat(1);
console.log(firstValue);

about 4 years ago · Juan Pablo Isaza Report

0

Try this:

var test = [
  [
    [3.12234, 50.12322],
    [3.12332, 12.12323],
    [3.431232, 122.22317],
  ],
]

var open = test[0] // get the array
[2] // get either [3.12234, 50.12322], [3.12332, 12.12323], or [3.431232, 122.22317] 
[1] // get item [0] or [1] from each value
console.log(open);
<body>

</body>

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!