I know it's very simple, but tried searching and could'nt find anything that would solve my problem.
So let's say I have this array:
var chicken = [10, 45, 150, 5000, 25000, 100000, 150000];
and I want to remove everything except 25000. So I tried a simple iteration:
for (var w=0; w<chicken.length; w++){
if (chicken[w]<25000 || chicken[w]>25000){
chicken.splice(w,1);
}
}
And it doesn't work. The output is [ 45, 5000, 25000, 150000 ], don't know why.