How to remove/unset specific array in javascript? I tried to use splice but i get different result. I think I'm missing something here.
var arr = [12, 3, 150];
var min = 100;
var max = 200
for (var key2 in arr) {
if (min > arr[key2] || arr[key2] >= max) {
arr.splice(key2, 1);
}
}
console.log(arr);
Current code output: [ 3, 150 ]
Expected output: [150]
filtermethod and provide predicate in its callback