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

224
Views
JavaScript Multidimensional Array - TypeError: Cannot set properties of undefined - cause?

I am getting the error TypeError: Cannot set properties of undefined and am unsure why.

let studentName = "";
var ID;
let studentClass;
let faculty="";
IDarray = [[studentName , ID , studentClass , faculty]]; // <--defined here

Then at this point below, the array is in a for-loop and the variables 'e.g. studentName' have values.

for(let i = 0; i < 2; i++){

*...variables with their values...*

IDarray[i][0] = [studentName , ID , studentClass , faculty]; //<--throwing error?!?

}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I was assigning values wrong. Incorrect way was

IDarray[i][0] = [studentName , ID , studentClass , faculty];

correct way was"

IDarray[i] = [studentName , ID , studentClass , faculty]; <-- cus this thing is the [0] array
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!