arguments

  • 是一个对象
  • 是一个可迭代对象
  • 像数组但不是数组
  • 里头存放着所有参数
 1 function showName() {
 2   alert( arguments.length );
 3   alert( arguments[0] );
 4   alert( arguments[1] );
 5 
 6   // 它是可遍历的
 7   // for(let arg of arguments) alert(arg);
 8 }
 9 
10 // 依次显示:2,Julius,Caesar
11 showName("Julius", "Caesar");
12 
13 // 依次显示:1,Ilya,undefined(没有第二个参数)
14 showName("Ilya");
原文地址:https://www.cnblogs.com/flyover/p/14148000.html