<!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>
闭包可以理解为一个访问一个函数内部变量的函数
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/8554.html