function between(x, min, max) { return x >= min && x <= max; } // ... if (between(x, 0.001, 0.009)) { // something }