if (x >= 0 && x <= 4) { // ... }
function inBetween(x, a, b) { return x >= a && x <= b } var x = 2 if (inBetween(x, 0, 4)) { alert(true) }