Shortest code to check if a number is in a range in JavaScript This is how I checkout to see if a number is in a range (in between two other numbers):

var a = 10,
    b = 30,
    x = 15,
    y = 35;

x &lt; Math.max(a,b) &amp;&amp; x &gt; Math.min(a,b) // -&gt; true
y &lt; Math.max(a,b) &amp;&amp; y &gt; Math.min(a,b) // -&gt; false


I have to do this math in my code a lot and I'm looking for shorter equivalent code. 

This is a shorter version I came up with. But I am sure it can get much shorter:

a &lt; x &amp;&amp; x &lt; b
true
a &lt; y &amp;&amp; y &lt; b
false


But downside is I have to repeat x or y
13 chars, checks both variants a&lt;b and b&lt;a

(x-a)*(x-b)&lt;0


In C may be used expression (may be also in JavaScript). 11 chars, No multiplications (fast)

(x-a^x-b)&lt;0