Angular js/javascript count how many times an iteration

I have my code below i wanted to know how will i get the count of all $scope.rm that is equal to failed or how many $scope.percentage < 50.

angular.forEach(result1, function (value, key) {

                    $scope.percentage = (value.score * 100 / value.total).toFixed(2);

                    if ($scope.percentage < 50) {
                        $scope.rm = "Failed"
                        $rootScope.sendmail = 0

                    }else {
                        $scope.rm = "Passed"
                        $rootScope.sendmail = 1
                    }

                });

Source: AngularJS