If .ready () is called after the DOM initialization, the new handler will be executed immediately.
This means that when the first function is executed, the internal one will be executed immediately.
In addition, jQuery allows you to associate several functions with one event and will call them all (provided that no one throws an error)
, :
jQuery(document).ready(function(){
for(i=0;i<1000000;i++);
console.log('2');
});
console.log('1');