首页 > 其他 > 详细

04-匿名函数

时间:2017-03-19 14:14:53      阅读:182      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>

//    function fn(){
//        console.log(1);
//    }

    //匿名函数。
//    (function (){
//        console.log(1);
//    })


    //调用方法:
    //1.直接调用
    (function (){
        console.log(1);
    })();

    //2.绑定事件
    document.onclick = function () {
        alert(1);
    }

    //3.定时器
    setInterval(function () {
        console.log(444);
    },1000);


</script>
</body>
</html>

  

04-匿名函数

原文:http://www.cnblogs.com/sj1988/p/6579912.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!