码迷,mamicode.com
首页 > Web开发 > 详细

JS匿名函数&闭包

时间:2015-05-29 13:39:56      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

<html>
    <head>
        <title>
        test
        </title>
    </head>
    <body>
        <script type="text/javascript">
            (function (){
                //局部变量
                var a=1;
                var b=3;
                alert(a+b);
            })();
            //undefinded
            alert(a);
        </script>
    </body>
</html>

 

JS匿名函数&闭包

标签:

原文地址:http://www.cnblogs.com/dannywang/p/4538176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!