I encountered an issue while attempting to add a new "field" into an array. It seems to stop at a specific number of objects within the array. For example, if my array contains 33 objects, the addition stops at the 7th object.
This is a snippet of my JavaScript code:
if ($scope.all[i].CATEGORY == 'Community')
{
$scope.community.push($scope.all[i]);
$scope.community[i].visibility = true;
console.log($scope.community[i])
}
The error message that I received is displayed here:
https://i.sstatic.net/BRiZQ.png
Note: The 'Visibility' attribute does not exist in my object; I am trying to insert it dynamically.
Additional information:
Upon logging the entire array, it shows all 33 objects present.
if ($scope.all[i].CATEGORY == 'Community')
{
$scope.community.push($scope.all[i]);
console.log($scope.community)
}
However, when using the [i] loop for logging:
if ($scope.all[i].CATEGORY == 'Community')
{
$scope.community.push($scope.all[i]);
console.log($scope.community[i]) <----
}
I get 6 valid returns and 27 undefined returns..