function foo(){
  log(arguments)
  
  // 类数组,通过下标得到值
  log(arguments[1])
  
  // arguments的值能够被修改
  arguments[2] = 'd';
  log(arguments[2])
  
  // arguments是类数组对象,有length属性,没有数组方法
  log(arguments.length)
  
  // 转为 真正的数组 之前的方法
  // https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
  const arg1 = Array.prototype.slice.call(arguments);
  log('arg1', arg1);
  const arg2 = [].slice.call(arguments);
  log('arg2', arg2);
  
  const arg5 = arguments.length  === 1? [arguments[0]]: Array.apply(null, arguments);
  log('arg5', arg5);
  
  // 转为真正的数组 ES2015新方法
  const arg3 = Array.from(arguments);
  log('arg3', arg3);
  const arg4 = [...arguments];
  log('arg4', arg4);
}

foo('a', 'c', 'b');

function log(a, b){
  document.write(`<div>${a} ${b?b:''}</div>`)
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.