[jQuery] Using jQuery $(this) with Arrow Functions

memo.

[markdown]
修行中です。
ES2015の新構文での this の扱いについて。
無名関数とアロー関数とでは関数内部から参照する this の扱いが異なる

> * [アロー関数 – JavaScript | MDN](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/arrow_functions)

jQueryを使っていてコールバック関数としてアロー関数を使いたい場合、従来の無名関数を使う方が良さそうかな。

> * [ES2015(ES6)新構文:アロー関数(Arrow function)|もっこりJavaScript|ANALOGIC(アナロジック)](http://analogic.jp/arrow-function/)

`this` が異なるわけなので、例えば下記の場合は `Event` を渡して `Event.currentTarget` で取り出せば良いようです。

> * [javascript – Using jQuery $(this) with Traceur (ES6 Harmony) Arrow Functions (lexical this binding) – Stack Overflow](http://stackoverflow.com/questions/27670401/using-jquery-this-with-traceur-es6-harmony-arrow-functions-lexical-this-bi)
> * [Event.currentTarget – Web API インターフェイス | MDN](https://developer.mozilla.org/ja/docs/Web/API/Event/currentTarget)

See the Pen Using jQuery $(this) with Arrow Functions by DriftwoodJP (@DriftwoodJP) on CodePen.


[/markdown]