Is there a way to remove an item from an array by its value rather than index, while ensuring compatibility with IE8? Any assistance would be greatly appreciated. Thank you.
Below is the array in question:
var myArray = ['one', 'two', 'three'];
The desired outcome should resemble this:
Delete operation:
myArray.splice('three');
Result:
myArray =['one', 'two'];
I attempted the above approach but encountered issues with IE8 compatibility.
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));
}
}
});