5 lines
87 B
JavaScript

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