javascript method not compiling in IE but works fine when running debug
<p>I made this javascript method that I altered from an existing script that I found online that should rotate showing an indefinite number of <code>'.testimonial'</code> divs. The script works fine in chrome and firefox, but doesn't compile in internet explorer, unless you use f12 to start the debugging of the script. <strong>Is there a better way to write this script?</strong> I have looked online for ideas but haven't been able to find anything. I imagine that the issue is with the <code>console.log(testimonialCount);</code> statement, but am unsure of a better way to write it. Any help would be greatly appreciated. Thanks.</p>

<pre><code>//rotate testimonials script
jQuery('.testimonial').hide();

var testimonialCount = $('.testimonial').length;
console.log(testimonialCount );
var currentItem = 0;
var timeout;
timeout = window.setTimeout((function(){switchDiv();}));    

switchDiv = function() {
    if (currentItem == testimonialCount - 1) {
        jQuery('.testimonial').eq(testimonialCount - 1).hide();
        currentItem = 0;
        jQuery('.testimonial').eq(0).fadeIn();
        timeout = window.setTimeout((function(){switchDiv();}),7000);
    }
    else {
        jQuery('.testimonial').eq(currentItem).hide();
        currentItem = currentItem + 1;
        jQuery('.testimonial').eq(currentItem).fadeIn();
        timeout = window.setTimeout((function(){switchDiv();}),7000);
    }
}
</code></pre>
