I want to store details where the number of columns of array are fixed and number of rows are unknown. I want to assign each column a key by extracting text from the div of a specific page and then assign the value to it. This is my code
var data1=[[]];
var val=0;
$('.education_box.eb1 .inner_box').each(function(){
$('.education_box.eb1 .inner_box ul li').each(function(){
var key= $(this).children('strong').text();
var value= $(this).children('em').text();
data1[key][val]= value;
});
val++;
});
console.log(data1);
Please let me know how to declare the 2D array in line 1 as each time it gives the error: Cannot set property '0' of undefined