title: How to change the context of a function in javascript
body: <p>I'm trying to understand why in javascript, you might want to change the context of a function. I'm looking for a real world example or something which will help me understand how / why this technique is used and what its significance is. </p>
  
  <p>The technique is illustrated using this example (from <a href="http://ejohn.org/apps/learn/#25" rel="nofollow noreferrer">http://ejohn.org/apps/learn/#25</a>)</p>
  
  <pre><code>var object = {}; 
  function fn(){ 
    return this; 
  } 
  assert( fn() == this, "The context is the global object." ); 
  assert( fn.call(object) == object, "The context is changed to a specific object." );
  </code></pre>