11 lines
659 B
Plaintext
11 lines
659 B
Plaintext
---
|
|
title: Can you offer a use case for the new arrow => function syntax?
|
|
subtitle: How does this new syntax differ from other functions?
|
|
---
|
|
|
|
One obvious benefit of arrow functions is to simplify the syntax needed to create functions, without a need for the `function` keyword. The `this` within arrow functions is also bound to the enclosing scope which is different compared to regular functions where the `this` is determined by the object calling it. Lexically-scoped `this` is useful when invoking callbacks especially in React components.
|
|
|
|
## References
|
|
|
|
- [Front End Interview Handbook](https://www.frontendinterviewhandbook.com/javascript-questions)
|