search

Home  >  Q&A  >  body text

javascript - Can arrow functions get event parameters when listening to events?

Can the arrow function get the event parameters when listening to events?

世界只因有你世界只因有你2788 days ago737

reply all(7)I'll reply

  • 滿天的星座

    滿天的星座2017-05-19 10:16:46

    1. Cannot be used arguments对象,在箭头函数内不存在这个对象,如果要是使用,可以使用rests也就是 ...
    2. The this object in the function body is the object where it is defined, not the object where it is used. This in an arrow function always refers to the object where the function definition takes effect.
    3. It cannot be used as a constructor, that is to say, the new command cannot be used, otherwise an error will be thrown.
    4. The yield command cannot be used, so the arrow function cannot be used as a generator function.

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-19 10:16:46

    The arrow function does not have its own this. This is determined when the arrow function is defined. The this of the arrow function is the this of the object containing the arrow function, while the this of the ordinary function is determined when it is called. Whoever calls this is who

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:16:46

    There is no arguments object in the arrow function. If you want to get the set of actual parameters, you need to use rest

    reply
    0
  • 高洛峰

    高洛峰2017-05-19 10:16:46

    Of course, the arrow function only affects the execution context, and the parameters of function will not be affected.

    reply
    0
  • 为情所困

    为情所困2017-05-19 10:16:46

    $('body').click(e => console.log(e)); 

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:16:46

    It can be completed

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-19 10:16:46

    You will know after you try it

    reply
    0
  • Cancelreply