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?!?
}
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