I have 2 array and want to remove the elements of 2nd array as per position numbers on 1st array.
var notexists = []; //value is "1","5","8" on 0,1,2nd position.
var copyrequiredfields = [];//Value is "a","b","c","d","e","f",...
for (var i = 0; i < notexists.length; i++) {
copyrequiredfields.splice(parseInt(notexists[i]), 1);
}
as per example i want to remove 1st 5th and 8th element from copyrequiredfields . Please suggest some answer.
sliceif you're basing the results on position. Of course,slicedoes not affect the initial array, likesplicedoes. Note thatsplicetakes a count, not a position.a?array.spliceandarray.filter. Hope it helps!