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

236
Views
Creating dynamic 3d arrays in javascript

I was looking to create a dynamic 3D array, here's the basic code I used:

const arr = new Array;
arr[0] = new Array;
arr[0][0] = new Array;

arr[0][0][0] = 'value1';
arr[1][0][0] = 'value2';

But I noticed that any value greater than 0 for the first 2 indexes throws

Uncaught TypeError: Cannot read property '0' of undefined

(0 is the value of the index following the previous which was greater than 0)

Is there a way to prevent this from happening without adding new arrays every time a new value is added?

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!