Javascript call changing type
<p>I want to write a function like jQuery each and am using the javascript call function.</p>

<pre><code>function each(array, callback) {
    for (var i=0; i&lt;array.length; i++) {
        console.log(typeof(array[i])); // Number
        callback.call(array[i]);
    }
}

each([1,2,3], function() {
    console.log(typeof(this)); // Object
});
</code></pre>

<p>The problem is call seems to be casting Number types to Object types. This causes issues with the console.log call. Can anyone explain why this is happening (my guess is that call casts arguments to type Object). Why would it do this? Can you figure out a way to work around or prevent this?</p>
