Custom Number.prototype working with variable but NOT working directly with number : <p>I have included custom Number.prototype in my JS as below:</p>

<pre><code>Number.prototype.isBetween = function (first, last) {
   return (first &lt; last ? this &gt;= first &amp;&amp; this &lt;= last : this &gt;= last &amp;&amp; this &lt;= first);
};
</code></pre>

<p>This is working as expected with below code:</p>

<pre><code>var a = 40;
a.isBetween(10,50)
</code></pre>

<p><strong>Result :</strong> 
true</p>

<p>But when i try to execute as below, it is throwing an error:</p>

<pre><code>40.isBetween(10,50)
</code></pre>

<p><strong>Result :</strong> 
Uncaught SyntaxError: Invalid or unexpected token</p>

<p>How to make this(40.isBetween(10,50)) work?</p>
