var b; setInterval(function (){ var a = Math.random(); console.log(a>b?'увеличилось':'уменьшилось'); b = a; },1000)