首页 > 编程语言 > 详细

javascript当中嵌套函数

时间:2020-12-26 20:27:12      阅读:34      评论:0      收藏:0      [点我收藏+]

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

javascript当中嵌套函数

原文:https://www.cnblogs.com/shituxingzhe1949/p/14190546.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!