title: Callback with arrow function in javascript
body: <p>Let's say there are two functions.</p>
  
  <pre><code>function foo(callback) {
  ...
  }
  
  function bar() {
  ...
  }
  </code></pre>
  
  <p>What's the difference when I call <code>foo(bar)</code> and <code>foo(() =&gt; bar())</code> by assuming bar requires no parameters?</p>
  
  <p>I recently former one occurs error regarding <code>this</code> context, while second one works just fine. I know arrow function binds <code>this</code> context into the function, I have no idea what's the difference.</p>
  
  <p>FYI, here is the code with issue.</p>
  
  <pre><code>socket.disconnect(socket.connect); // line 1
  
  socket.disconnect(() =&gt; socket.connect()); // line 2
  
  socket.disconnect(function() { socket.connect(); }); // line 3
  </code></pre>
  
  <p>I just found that the problem might not be related to the context. It might be something with apply or bind. Because line2 and line 3 works fine, while only line 1 shows error.</p>