Why doesn't JavaScript let you call methods on numbers directly?
<p>In Ruby, you can do this:</p>

<pre><code>3.times { print "Ho! " } # =&gt; Ho! Ho! Ho!
</code></pre>

<p>I tried to do it in JavaScript:</p>

<pre><code>Number.prototype.times = function(fn) {
    for (var i = 0; i &lt; this; i++) {
        fn();
    }
}
</code></pre>

<p>This works:</p>

<pre><code>(3).times(function() { console.log("hi"); });
</code></pre>

<p>This doesn't</p>

<pre><code>3.times(function() { console.log("hi"); });
</code></pre>

<p>Chrome gives me a syntax error: "Unexpected token ILLEGAL". Why?</p>
