jquery闭包

2021-09-24 14:23:04 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="application/javascript" src="./js/jquery.js"></script>
    <script type="application/javascript">
        (function($){
            $(function(){
                t();
            })
            var foo;
            var bar=function(){
                foo="aa";
                alert(foo);
            }
            $.adt=bar;
        })(jQuery)
        function t(){
            alert("dfdfdfdfd");
        }
    </script>
</head>
<body></pre>
 闭包可以理解为一个访问一个函数内部变量的函数 

0 人点赞