0

So, I'm trying to delete from an array if it's element value isn't equal to a value that I specified:

Code: http://pastebin.com/hUc3mVLv

$scope.enablePVR = function()
{
        for (i = 0; i < $scope.new_epg.length; i++) {
                start_time = convert_time($scope.new_epg[i].start);
                $scope.new_epg[i].title = $scope.new_epg[i].title.replace(/<(?:.|\n)*?>/gm, '');
                $scope.new_epg[i].description = "";
                $scope.new_epg[i].time = start_time;
        }
        archiveEPG = [];
        for(var i=0; i<archiveEPG.length; i++) {
                var e = document.getElementById("dateSelect");
                if($scope.new_epg[i].start.split(" ")[0] == e[e.selectedIndex].value) {
                        archiveEPG[archiveEPG.length+1] = $scope.new_epg[i];
                }
        }
        document.getElementById("dateSelect").remove(0);
        $scope.get_epg(null, true, archiveEPG);
}
Geert
  • 1,166
  • 7
  • 20
Zygimantas
  • 25,707
  • 5
  • 16
  • 23

1 Answers1

-1

.remove(0) isn't valid you can add this function to make it valid tho :

Array.prototype.remove = function(index) {
    return this.splice(index, 1); // The second parameter is the number of elements to remove.
}
Sebastien B.
  • 454
  • 3
  • 9