Anonymous vs. Arrow Functions
Learn the two main differences between the arrow and anonymous functions and choose your style accordingly.
Choosing between arrow and anonymous functions
At first sight, it may appear that arrow functions are direct replacements for anonymous functions. You may be tempted to hastily replace anonymous functions with arrow functions. However, this could result in code that behaves differently than you intend. There are many semantic differences between anonymous functions and arrow functions, and we have to carefully choose between them based on the context.
Learning about the key differences between the two types of functions will help you pick the right one.
In this lesson, we will cover the two main points
- Lexical vs dynamic scoping
- Differences in
bind
,call
andapply
Get hands-on with 1400+ tech skills courses.