i am tracking a variale value for example 
 var d = socket.msg;

i would like to excute a notification function if the value range of the var d falls between 0 and 2.

```
function x(){
   //some codings to pop up notification
 }

```

the variable d changes at each 1 second. i would like to just run the notication function only once eventhough the var d have multiple registeration of values in the given range.

```
if(d>0  && d <2  ) {
 function x
}

```

i tried this but logically the function x will be called several times.
how to set the function o be called only once??