Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
I agree. Also, if your next function happens to depend on results from the previous function, you can chain them without nesting:
functiongetAreas(){}functiongetTowns(areas){}functiongetCities(towns){}functiongetCountries(cities){}getAreas().then(getTowns).then(getCities).catch(handleError);// or inlinegetAreas().then(functiongetTowns(areas){}).then(functiongetCities(towns){}).then(functiongetCountries(cities){}).catch(functionhandleError(){});
I agree. Also, if your next function happens to depend on results from the previous function, you can chain them without nesting:
Nice article overall though, keep it up :).
Yes, this would be a good approach too :)