<!DOCTYPE html>
<html lang="en"><head> <meta charset="UTF-8"> <title>closure的自调用函数式写法</title> <script type="text/javascript"> var a = (function(name){ var n = name; return function(){ console.log(n); } })('Lucy'); a(); //本例已经通过验证 </script></head><body> </body></html>