- IIFE的使用
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>039</title>
</head>
<body></body>
<script type="text/javascript">
(function () {var i = 0;function increment(){i ++ ;console.log("value is " + i);}function runIncrement () {while (i < 5) {increment();}}window.onload = function(){runIncrement();}})();
</script>
</html>