I have an array like this:
peoples = ['dick', 'jane', 'harry', 'debra', 'hank', 'frank' .... ]
And one of them contains such keys:
keys = [1, 6, 3, 12 .... ]
Now I could write something like this:
var peoplesStripedOfKeyPostions = []; for(i = 0; i < peoples.length; i++){ for(j = 0; j < keys.length; j++){ if( i !== keys[j]){ peoplesStripedOfKeyPostions.push( peoples[i] ); } } }
If you cannot say, I need to create an array of people who are deprived of people in certain positions defined in the keys of the array. I know that there must be a great and effective way to do this, but of course I canβt think about it. (array management is not my forte).
Do you know the best way to do this? (If I get some working answers, jsperf determines the winner.)
source share