I have an array of [2016,2017,2018,2019]
I have a range fromValue 2017 toValue 2017
Hence resulting array should be [2017] because of i need to remove whatever out of range between fromValue and toValue.
I have written code below which is only removing 2016 and 2018 but not 2019.
Whats wrong i am doing , is there any beter way to do this?
gNodeIDs.forEach(function (item) {
alert("Before if" + item);
if (item >= fromValue) {
if (item <= toValue) {
}
else
{
alert("removing" + item);
var index = test.indexOf(item);
if (index >= 0) {
test.splice(index, 1);
}
}
}
else {
alert("removing" + item);
var index = test.indexOf(item);
if (index >= 0) {
test.splice(index, 1);
}
}
});