异步API

  整合到一起,作为参考:

    //2 5 3 4 1
    //2 5 3 1 4
    var img = new Image();
    img.src = '.';
    img.onerror = function() {
        console.log(1);
    };
    console.log(2);
    Promise.resolve().then(() => console.log(3));
    setTimeout(() => console.log(4), 0);
    Promise.resolve(console.log(5));

 

posted @ 2017-03-09 20:25  书生小龙  阅读(257)  评论(0编辑  收藏  举报