If you have read my previous article about chaining promises, you’ll know I love using small functions in “then” methods, but sometimes chaining is not that simple.
For example, when you have to execute in your “then” method a function receiving two parameters it is not possible… or it is?
In these cases you can use some alternatives as seen below:
- Using an anonymous function to chain our second promise
- Use “bind” to pass the second parameter to our second function
- Wrap our second function into another function and chain this wrapper instead.