var difference = function (a, b) { return Math.abs(a - b); }
if (500 < thenumber && thenumber < 600) { // ... }