Anonymous vs. Arrow Functions

At first sight, it may appear that arrow functions are direct replacements for anonymous functions. You may be tempted to readily replace anonymous functions with arrow functions. But that may 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.

Lexical vs. Dynamic Scoping

Most variables used in any function either come from the parameters or are defined locally. However, some variables can be defined in an external context. Let’s consider a short example. ...

Get Rediscovering JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.