zoukankan      html  css  js  c++  java
  • arguments.callee和arguments.callee.caller的却别

    <html>
        <head>
            <script type="text/javascript">
                function handleClick(abc)
                {
                    var div=document.createElement("div");
                    div.innerHTML=abc;
                    
                    document.body.appendChild(div);                
                }

                

                function processArray(items,process,callback)
                {                            
                    var todo=items.concat();//克隆数组

                    setTimeout(function(){
                        var item=todo.shift();
                        process(item);
                        
                        if(todo.length>0)                     
                        {
                            setTimeout(argument.callee,25);
                        }
                        else
                        {
                            callback(items);
                        }
                    },25)
                }

                function test()
                {
                    var items1=[123,234,345,456,567,678,789,890];
                    
                    processArray(items1,handleClick,function(){document.write("done");})
                }

                function check()
                {                                            
                    document.write("arguments:" + arguments.length +'<br>');  
                    document.write("arguments.callee:" + arguments.callee.length   +'<br>'); 
                    alert(arguments.callee.caller.toString());
                    alert(arguments.callee.toString()); 
                }  
              
                function f(x, y, z){                             
                    document.write("arguments:" + arguments.length +'<br>');  
                    document.write("arguments.callee:" + arguments.callee.length   +'<br>');   
                    check(arguments);                  
                }  
               
            </script>    
        </head>
        <body>
            <input type="button" onclick="handleClick()" value="Cliek Me"/>
            <input type="button" onclick="f(1,2)" value="test"/>
        </body>
    </html>
  • 相关阅读:
    【已解决】ERR_BLOCKED_BY_XSS_AUDITOR:Chrome 在此网页上检测到了异常代码:解决办法
    【已解决】Microsoft visual c++ 14.0 is required问题解决办法
    爬虫处理网站的bug---小于号未转化为实体符
    pymysql 在数据库中插入空值
    python 正则括号的使用及踩坑
    pymysql 解决 sql 注入问题
    python3 操作MYSQL实例及异常信息处理--用traceback模块
    LeetCode 837. 新21点 | Python
    LeetCode 面试题64. 求1+2+…+n | Python
    LeetCode 101. 对称二叉树 | Python
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/2608385.html
Copyright © 2011-2022 走看看