My code is as follows.
script.js
var main = function(){
    for(var j=0; j<10; j++){
        for(var i=0; i<10; i++){
            setTimeout(function(){$('div').append(i*j);}, 1000*j);
        };
    };
};
$(document).ready(main);
index.html
<html>
    <head>
    </head>
    <body>
    <div></div>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="script.js"></script>
    </body>
</html>
I want to display
(sec1)00000000000
(sec2)00000000000123456789
(sec3)000000000001234567890246891012141618
......
, but it display
(sec1)100100100100100100100100100100
(sec2)100100100100100100100100100100100100100100100100100100100100
(sec3)100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100
......
Why?What should I do?
 
    