I want to delete one item from the array using its value instead of index which will work on IE8. Any help will be appreciated. Thanks.
Here is my array:
var myArray = ['one', 'two', 'three'];
The result should be something like:
delete operation:
myArray.splice('three');
result:
myArray =['one', 'two'];
I tried this but its not working in IE8.
angular.forEach($scope.leftList, function (leftItems) {
var arrlen = $scope.rightList.length;
for (var j = 0; j<arrlen; j++) {
if (leftItems == $scope.rightList[j]) {
$scope.rightList = $scope.rightList.slice(0, j).concat($scope.rightList.slice(j+1, arrlen));
}
}
});