Update count every second causing massive memory problems

Posted by Josh on Stack Overflow See other posts from Stack Overflow or by Josh
Published on 2010-06-02T11:56:41Z Indexed on 2010/06/02 12:03 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

Just on my local machine, trying the run the following script causes my computer to crash... What am I doing wrong?

            (function($) {
            var count = '6824756980';
            while (count > 0) {
                setInterval(function() {
                    $('#showcount').html(Math.floor(count-1));
                    count--;
                }, 1000 );
            }
        })(jQuery);

All I need to do is subtract one from the var "count" and update/display it's value every second.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about count