 <p>You can run my demo code and see what the error means.</p> <p>When you loop over an array and expect to call a method you need to validate that it exists, first.</p> <pre><code>var arr = [0, {test: function(){}}]; // the error - Uncaught TypeError: Object 0 has no method 'test' //arr.forEach(function(e) { // e.test(); //}); // the right way arr.forEach(function(e) { if (e &amp;&amp; e.test) { e.test(); } else { console.log("no valid element or no support for method 'test'"); } }); </code></pre>