title: What is the difference between using class and function notation when creating a class?
body: <p>I'm having trouble finding information about the difference between these two ways of writing classes. Do they behave differently? why might you use one over the other ?</p>
  <pre><code>var Greeter = function(greeting) {
      this.greeting = greeting;
  };
  
  Greeter.prototype.greet = function() {
      console.log(this.greeting);
  }
  
  var hello = new Greeter(&quot;hello&quot;);
  hello.greet();
  </code></pre>
  <p>versus:</p>
  <pre><code>class Greeter {
      greeting;
  
      constructor(greeting) {
          this.greeting = greeting;
      }
  };
  
  Greeter.prototype.greet = function() {
      console.log(this.greeting);
  }
  
  var hello = new Greeter(&quot;hello&quot;);
  hello.greet();
  </code></pre>