javascript - Can arrow functions get event parameters when listening to events?
世界只因有你
世界只因有你 2017-05-19 10:14:46
0
7
661

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

世界只因有你
世界只因有你

reply all(7)
滿天的星座

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.

仅有的幸福

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

过去多啦不再A梦

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

小葫芦

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

为情所困
$('body').click(e => console.log(e)); 

过去多啦不再A梦

It can be completed

phpcn_u1582

You will know after you try it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!