level 9
yanmou626
楼主
前一段时间看了本书,做个总结:
lIn the JavaScript, implement closure through function (variable from function body) definein the function body.
例子如下:
<html>
<body>
<script type="text/javascript">
function a(){
var i=0;
function b(){
alert("Hello World!"+(++i));
}
return b;
}
var c=a();
c();
c();
</script>
</body>
</html>
2015年10月21日 07点10分
1
lIn the JavaScript, implement closure through function (variable from function body) definein the function body.
例子如下:
<html>
<body>
<script type="text/javascript">
function a(){
var i=0;
function b(){
alert("Hello World!"+(++i));
}
return b;
}
var c=a();
c();
c();
</script>
</body>
</html>