Callbacks are common in JavaScript, but a traditional function expression can be verbose—and its `this` can change when another function invokes it. An arrow function uses `=>` between its parameters and body. It offers shorter syntax and takes `this` from its surrounding context rather than from the way it is called. section 5.1.2 section 6.3.2
A shorter function
`const greet = name => "Greetings " + name;` returns the expression without braces or a `return` keyword. A single parameter can omit parentheses; zero or multiple parameters require them. With a braced body, use an explicit `return` when you want to return a value: `const greet = name => { const prefix = "Greetings "; return prefix + name; };` section 5.1.2
The difference from an ordinary function matters most when functions are passed around. Passing an object's method directly as an event callback separates the function from its object, so expecting `this` to remain that object can produce a broken click count. An arrow function instead keeps the `this` of the context in which it was defined. Calling it with `call` or `apply` cannot change that value; `bind` cannot give it a different `this` either. section 6.3 section 6.3.2
Keep the method call intact
For an ordinary object with `clickHandler`, register `() => { buttonObject.clickHandler(); }` as the event callback. The arrow is a wrapper: it calls the method through `buttonObject`, preserving that method call's context. Do not replace the object's `clickHandler` itself with an arrow expecting `this` to mean `buttonObject`; an ordinary object literal does not create a lexical context. section 6.3.2
Use an arrow when its compact expression form or inherited `this` is what you need. When a function must receive `this` from the object used to invoke it, keep the distinction between an arrow and an ordinary method in mind. section 5.1.2 section 6.4








