javascript当中嵌套函数


3)嵌套函数
例 3.3.1
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</head>
<script>
    function outerFun(){
        var i = 0;
        function innerFun(){
            document.write(i);
        }
        innerFun();
    }
    outerFun();
    /*here you can not call innerFun(), because it is inside another function outerFun, so it will cause error.*/
    innerFun();
    document.write("马克-to-win");
</script>

文章转载自:https://blog.csdn.net/qq_44594249/article/details/99978852


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM