Javascript 从数组中删除不会';行不通

Javascript 从数组中删除不会';行不通,javascript,html,angularjs,Javascript,Html,Angularjs,因此,如果数组的元素值不等于我指定的值,我将尝试从数组中删除: 代码: $scope.enablePVR=function() { 对于(i=0;i

因此,如果数组的元素值不等于我指定的值,我将尝试从数组中删除:

代码:

$scope.enablePVR=function()
{
对于(i=0;i<$scope.new_epg.length;i++){
开始时间=转换时间($scope.new\u epg[i].start);
$scope.new_epg[i]。title=$scope.new_epg[i]。title.replace(//gm',);
$scope.new_epg[i].description=“”;
$scope.new\u epg[i]。时间=开始时间;
}
archiveEPG=[];
对于(var i=0;i
.remove(0)
无效,您可以添加此函数使其有效,方法如下:

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

请在问题提示中粘贴相关代码:
for(i=0,len=arr.length;i
而不是PasteBin让您了解如何在Plnkr上发布它,以便我们可以查看和测试发生了什么?diEcho是对的,因此每次都不会计算长度。我建议将
值重命名为
索引
shift()
在浏览器上不受支持?如果它不是polyfill,则不应扩展语言对象的原型。除此之外,
.remove(0)
在domeElement上调用,而不是在数组上调用。
Array.prototype.remove = function(index) {
    return this.splice(index, 1); // The second parameter is the number of elements to remove.
}