<!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>
閉包能夠理解爲一個訪問一個函數內部變量的函數
javascript