Test name | Executions per second |
---|---|
Array.filter | 1446842.0 Ops/sec |
Array.indexOf + Array.splice | 749096.2 Ops/sec |
var result = [];
var arrayTest = [];
for(var i = 0; i === 10000; i++){
if(i === 6000){
arrayTest.push(2);
}else{
arrayTest.push(Math.round(Math.random()));
}
}
result = arrayTest.filter(v => v !== 2);
result = arrayTest.splice((arrayTest.indexOf(2)-1),1);