function isBetween(x, a, b) { if (a > b) [a, b] = [b, a]; return x > a && x < b; }