1、语法

  1. var go=function(){
  2. console.log("hello world");
  3. }
  4. go();
  5. var show = () =>{
  6. console.log("world");
  7. }
  8. show();
  9. //如果箭头函数中只有一段语句可以简写
  10. var test = () =>console.log("test");
  11. test();

2、箭头函数的参数

  1. var go =x=>console.log(x);
  2. go(10);
  3. var sum =(y,z)=>console.log(y+z);
  4. sum(3,4);