没有argument的概念,有了rest剩余参数的概念
x var add=(x,y)=>{ console.log(arguments) } add(1,2,3,4)//arguments is not defined//没有定义 var add=(x,y,...rest)=>{ console.log(rest)//[3,4] a.push(x,y);//把所有的参数都遍历出来,这是在之后追加[3,4,1,2] a.unshift(x,y);//这是之前追加[1,2,3,4],这两个都可以得到arguments效果 } add(1,2,3,4)//rest存多余的参数箭头函数:箭头函数中this,指向的是定义的时候所在对象,不是使用的时候所在对象
//箭头函数:箭头函数中this,指向的是定义的时候所在对象,不是使用的时候所在对象 var stu={ name='zs } var add=(x,y,...rest)=>{ console.log(this) console.log(rest) a.push(x,y); a.unshift(x,y); }//这个箭头函数的普通函数定义(的时候指向的window add(1,2,3,4) add.call(stu,1,2);//加不加这个都是指向window