June 2018
Beginner
288 pages
6h 31m
English
Due to their concise and expressive nature, we’ll be tempted to use arrow functions rather than anonymous functions. However, the choice should not be due to infatuation. Learning about the limitations of arrow functions will help us make an educated choice between anonymous functions and arrow functions.
Named anonymous function sounds like an oxymoron, but a function created in the argument list of a method call may be given a name. Here’s an example of naming a function that’s created just in time in the argument list.
| | setTimeout(function repeat(count) { |
| | console.log('called...'); |
| | if(count > 1) |
| | setTimeout(repeat.bind(null, count - 1), 1000); |
| | }.bind(null ... |