title: How to use a JS class member as callback (ES6)?
body: <p>I'm asking for the most common way to use a class member as callback as shown here: <a href="http://jsfiddle.net/3fupbut9/7/" rel="nofollow noreferrer">http://jsfiddle.net/3fupbut9/7/</a></p>
  
  <pre><code>// function that calls the callback
  function call(cb) {
      cb();
  }
  
  // class containing the callback
  class UnderTest {
      constructor() {
          this.number = 5;
      }
  
      // method to be called as a callback by someone else
      printNumber() {
          alert(this.number);
      }
  
      // current solution
      printNumberCB() {
          return function() {
              this.printNumber();
          }.bind(this); 
      }
  }
  
  var underTest = new UnderTest(); // creat a new instance
  underTest.number = 7;
  underTest.printNumber(); // print number directly
  call(underTest.printNumberCB()); // print number by callback
  </code></pre>
  
  <p>I am a C++ dev and very new to JavaScript and currently play around with nodejs and express. I think I understand how <code>this</code> works in JS but what is the most common way using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes" rel="nofollow noreferrer">ES6 classes</a>.
  My real example is an express router callback.</p>