I am working on a script in which i need some data based on a lot of timestamps.
Below is just an example
var timestampData1 = [1555486016,1555486017,1555486018...];
var timestampData2 = [1555486016,1555486017,1555486018...];
var data = [];
data[1] = [];
$.each(timestampData1,function(index,value) {
data[1][value] = 1;
});
data[2] = [];
$.each(timestampData2,function(index,value) {
data[2][value] = 1;
});
console.log(data);
The example above will output the following in the console
However if i examine the data in the console, i see a lot of empty sets counting from 0 up to the very last timestamp
So my question is:
Will javascript set all of these indexes, or is it simply an indication in the console? If not, i guess that it is very bad for performance, doing it like above ?