TypeError: (intermediate value)(...) is undefined
<p>I was toying with the number object and I came up with this code (I know this is not good practice):</p>

<pre><code>Number.prototype.times = function (evalString) {
  for (let i = 0; i &lt; this; i++) {
    eval(evalString);
  }
}
//var someVar= 3;
(8).times("alert('kek')");
</code></pre>

<p>and it seems to work only when the someVar variable is not commented out, otherwise it throws the error in the title.</p>

<p>What causes this behavior?</p>