I want to create array for each user and store them in another array. For that I used this code:
var arrs = [];
var userCount = 1;
@foreach($eventUsers as $user)
{
arrs['arr' + userCount] = [];
userCount++;
}
and console.log(arrs); gave me the output
[arr1: Array[0], arr2: Array[0], arr3: Array[0], arr4: Array[0]]
Then I need to push elements to each array(arr1, arr2, arr3, arr4)
while looping through 'arrs
'
I tried using:
for (arr in arrs) {
arr.push('x');
}
But didn't work. Can anyone give me a solution?