I'm trying to get existCount from an array, which has id in selected array.
But something went wrong, I had an item with id = 5493
but existCount.length 0
My JS code:
var existCount = $scope.selectedScript.filter(function (item) {
return item.id === script.script_id;
});
console.log('existCount.length ', existCount.length);
console.log('$scope.selectedScript ', $scope.selectedScript);
console.log('script.script_id ', script.script_id);
Chrome Console view:
https://i.stack.imgur.com/4UVWw.png
// Sorry I forgot the first output line, but this line's at the top of $scope.selectedScript
and it was existCount.length = 0
Where my fault?
How can I fix it?
Thanks!