javaScript异步操作处理

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/qq_37858220/article/details/84394351
<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
</head>
<body>

</body>
</html>
<script type="text/javascript">
    $(function () {
        test(function () {
            console.log("执行回调");
        });
        console.log("$");
    });

    function test(callFun) {
        setTimeout(function () {
            console.log("执行异步操作");
            callFun();
        }, 0);

        console.log("succeed");
    }

</script>

执行结果图片

标题

猜你喜欢

转载自blog.csdn.net/qq_37858220/article/details/84394351
今日推荐