zoukankan      html  css  js  c++  java
  • arguments

     1 <!DOCTYPE html>
     2 <html>
     3     <head>
     4         <meta charset="UTF-8">
     5         <title></title>
     6         <script type="text/javascript">
     7             /*
     8              * 在调用函数时,浏览器每次都会传递进两个隐含的参数:
     9              *     1.函数的上下文对象 this
    10              *     2.封装实参的对象 arguments
    11              *         - arguments是一个类数组对象,它也可以通过索引来操作数据,也可以获取长度
    12              *         - 在调用函数时,我们所传递的实参都会在arguments中保存
    13              *         - arguments.length可以用来获取实参的长度
    14              *         - 我们即使不定义形参,也可以通过arguments来使用实参,
    15              *             只不过比较麻烦
    16              *             arguments[0] 表示第一个实参
    17              *             arguments[1] 表示第二个实参 。。。
    18              *        - 它里边有一个属性叫做callee19              *             这个属性对应一个函数对象,就是当前正在指向的函数的对象
    20              *         
    21              */
    22             
    23             function fun(a,b){
    24                 //console.log(arguments instanceof Array);//false
    25                 //console.log(Array.isArray(arguments));//false
    26                 //console.log(arguments[1]);//"hello"
    27                 //console.log(arguments.length);//2
    28                 console.log(arguments.callee == fun);//true
    29             }
    30             
    31             fun("hello",true);
    32             
    33         </script>
    34     </head>
    35     <body>
    36     </body>
    37 </html>
    活到老,学到老。 踏实+激情+坚持
  • 相关阅读:
    CodeForces
    CodeForces
    AtCoder
    AtCoder
    CodeForces
    CodeForces
    CodeForces
    CodeForces
    Centos7配置yum国内镜像及仓库升级
    环境变量
  • 原文地址:https://www.cnblogs.com/andyZhang0511/p/10805048.html
Copyright © 2011-2022 走看看