So, code below throws undefined if index is not existing in the array
Note: it's array of arrays
arr[index] = arr[index].concat(data);
Eventually I've fixed it with check
if (!array[index]) {
array[index]=[];
}
Which solved the problem.
Question: is there any JavaScript trick which could solve this problem easier (less lines of code, without checks, whatever)?
ifstatement, they just present it in a different way.