trying to rewrite each - is there a better approach to this?
<p>I'm trying to create my own each similar to jquery each. I get the expected output. I'm not sure why supplying "this" to the callback.call makes my code work. Is there any other approach to achieve the same behavior?</p>

<pre><code>function print(val){
  console.log(val);
}

function each(list, callback){
  for(var i = 0; i &lt; list.length; i++){
    callback.call(this, list[i]);  
  }
}


var list = [1, 2, 3];

each(list, print);
</code></pre>