I have two script.
First:
a = 0;
for (var i = 1000000000 - 1; i >= 0; i--) {
    a += i;
};
console.log(a);
Secend:
setInterval(function(){
    if (l.data('pos') == 0) {
        l.css('margin-left', '10px');
        l.data('pos', '1');
    }else{
        l.css('margin-left', '0');
        l.data('pos', '0');
    }
}, 100);
As you see, browser run second section after finishing first section.
Can I run first section in background and second section runs from document ready?
 
     
    