I have the following Javascript function where the parameters newValue and oldValue are arrays of integers and the same length. Any values in these arrays can be an integer, undefined or null:

```
function (newValue, oldValue) {

});

```

Is there some way that I could check the values in the arrays one element at a time and then do an action only if:

```
newValue[index] is >= 0 and < 999
oldValue[index] is >= 0 and < 999
newValue[index] is not equal to oldValue[index]

```

What I am not sure of is how can I handle in my checks and ignore the cases where newValue or oldValue are not null and not undefined? I know I can do a check as in if (newValue) but then this will show false when it's a 0. 

**Update:**

I had a few quick answers so far but none are checking the right things which I listed above.