title: Pass function to javascript class
body: <p>On my index.html, I have this code,</p>
  
  <pre><code>$(document).ready(function() {
      var self = this;
      var submit = function() {
          alert("Test");
      }
      const form = new Form(self.submit);
  })
  </code></pre>
  
  <p>In my Form.js, I have this code,</p>
  
  <pre><code>class Form() {
      constructor(func) {
          var self = this;
          // ...
          $("submitBtn").click(function(e) {
             e.preventDefault();
             self.func();
          });
          // ...
      }
  }
  </code></pre>
  
  <p>Why my function is not executing after the submitBtn is clicked?
  I used self to get the "this" value. I cant use "new Form(self.submit())" because It will execute the function once the line is read. </p>