Async Sample

Show how async behavior ships a function to the end of the runtime queue

HTML

<div></div>

JavaScript

var function1 = function() {
    $('<p/>').text("...can you believe this fired last?").appendTo('div');
}

var function2 = function() {
    $('<p/>').text("So you know this is first and followed by...").appendTo('div');
}

var function3 = function() {
    $('<p/>').text("...this one. But...").appendTo('div');
}

var checkIt = function() {
    setTimeout(function1, 0);
    
    function2();
    function3();
}

checkIt();