ES6 ARROW FUNCTIONS - vijayetar/seattle-301d55 GitHub Wiki
Arrow functions
-
There are a few caveats with arrow functions, though. Most importantly, arrow functions affect function scope. Typically, the scope of a function is within its opening and closing curly braces, called a code block. However, when an arrow function is used, the scope of the function bubbles up to the next-nearest scope. This can be an enclosing function, or if it is a deeply-nested function, the closest function that does not use an arrow function. If arrow functions are used exclusively in a file, the scope of the function will become the global window object.
-
Why does this happen? Arrow functions do not bind "this", so the context of "this" bubbles up to the global window object, which is the next-nearest enclosing scope. Therefore, you will want to avoid using an arrow function in a constructor or any method that needs to use "this" to behave properly.