title: Uncaught TypeError: Person is not a constructor
body: <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>var Person = (function () {
      var name = Symbol('name');
      class Person {
      constructor(name) {
          this[name] = name
      }
      getname() {
          return this[name];
      }
    }
  }());
  
  var person = new Person();
  console.log(person.getname())</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm making a small example via a tutorial on Google. This example prevents to access property this.name from outside scope. But I'm getting error </p>
  
  <blockquote>
    <p>Uncaught TypeError: Person is not a constructor.</p>
  </blockquote>
  
  <p>How can I solve it?</p>