title: Variable not defined inside ES6 class without 'let' or 'var'
body: <p>When I use the ES6 class syntax, a variable inside a method declared without 'let' or 'var' is undefined. However, when using the regular object syntax, it is defined.</p>
  
  <p>To illustrate the problem, I run the following code on Node v7.5.0:</p>
  
  <pre><code>class ES6Foo {
  
     bar() {  
  
         var i = 5446;
         console.log("i = " + i);
  
         let j = 5446;
         console.log("j = " + j);
  
         k = 5446;
         console.log("k = " + k);
  
      }
  }
  
  foo = new ES6Foo();
  foo.bar();
  </code></pre>
  
  <p>produces the output:</p>
  
  <pre><code>i = 5446
  j = 5446
  .../ES6Foo.js:10
      k = 5446;
        ^
  ReferenceError: k is not defined
  at ES6Foo.bar 
  </code></pre>
  
  <p>Not using the class syntax solves this problem:</p>
  
  <pre><code>var OldFoo = function() {}
  
  OldFoo.prototype.bar = function() {
  
     var i = 5446;
     console.log("i = " + i);
  
     let j = 5446;
     console.log("j = " + j);
  
     k = 5446;
     console.log("k = " + k);
  
  }
  
  foo = new OldFoo();
  foo.bar();
  </code></pre>
  
  <p>produces:</p>
  
  <pre><code>i = 5446
  j = 5446
  k = 5446
  </code></pre>
  
  <p>Can anyone explain this behavior?</p>