"[].forEach"?​​
<p>I saw this script somewhere else, and it will check every single checkboxes:</p>

<pre><code>[].forEach.call(document.querySelectorAll('input[type="checkbox"]'),function(el){
       el.checked=true;
    }
);​
</code></pre>

<p>I know how to use <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach"><code>forEach</code></a>:</p>

<pre><code>[0,1,2].forEach(function(num){
    console.log(num);
});

//0
//1
//2
</code></pre>

<p>But now, it is <code>[].forEach</code>, and there is nothing inside. So why does it still work? Why can't I do this instead?</p>

<pre><code>document.querySelectorAll('input[type="checkbox"]').forEach(function(el){
       el.checked=true;
    }
);​
</code></pre>
