title: Javascript call function
body: <p>I have been testing some code lately trying to understand javascript a little bit better. Then I came across the <code>call()</code> function wich I can't get to understand well.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>function hi(){
      console.log("hi");
  }
  
  var bye = function(param, param2){
      console.log(param);
      console.log(param2);
      console.log("bye");
  }
  </code></pre>
  
  <p>If I call <code>bye.call(hi(), 1, 2)</code>, I get <code>hi 1 2 undefined</code></p>
  
  <p>And if I call <code>bye.cal(1,2)</code>, I get <code>2 undefined bye undefined</code></p>
  
  <p>for which I understand the <code>call()</code> function first parameter has to be a function, followed by the amount of parameter my <code>bye</code> function accepts. But where is the last undefined coming from?</p>