title: Pure js code works in Firefox but not Chrome
body: <p>The code below works fine in Firefox, in Chrome it behaves quite strage. For short loops(below several hundreds) it works, but for large it never ends. Sometimes it can break from that infinite loop and complete.</p>
  
  <p>This could be fixed by replacing "delete _scope.context" with _scope.context=undefined</p>
  
  <p>Can someone elaborate what is going on here?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function() {
    var _module = function() {
      const _scope = function() {
        var a = 0,
          block = 0;
        var suspend = function() {
          var context = {};
          context.a = a;
          context.block = block;
          context.resume = function() {
            _scope.context = context;
            return _scope();
          }
          _scope.context = context;
          return context;
        }
        var awake = function() {
          context = _scope.context;
          delete _scope.context;
          //_scope.context = undefined;
          a = context.a;
          block = context.block;
        }
        if (_scope.context !== undefined) {
          awake();
        }
        while (true) {
          switch (block) {
            case 0:
              block = 1;
              return suspend();
            case 1:
              block = 0;
              if (a++ &gt; 10000) {
                return;
              }
              continue;
          }
        }
      }
      return _scope();
    }
  
    var runMod = function() {
      var susp = _module();
      var nSteps = 0;
      while (susp) {
        susp = susp.resume();
        if (!(++nSteps % 1000)) {
          console.log(nSteps, susp);
        }
        if (nSteps &gt; 100000) {
          console.log('aborted')
          break;
        }
      }
      console.log('complete', nSteps);
    }
  
    runMod();
  })()</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.as-console-wrapper {
    max-height: 100% !important;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/daborkpw/" rel="nofollow noreferrer">https://jsfiddle.net/daborkpw/</a></p>