In a previous article I demonstrated how a new feature from ES2016 (
await functions) could be used to help coordinate promises and execution.
However, we are instead able to use Generators (introduced in ES2015) to provide this feature, minus the syntactic sugar these two new keywords provide.
One feature of ES2015 that I feel can be a stumbling block (but extremely useful) is Arrow Functions lexical scoping of
Before this addition, every new function defined its own
this - meaning we were required to explicitly bind or locally store the
this reference that we desired in many use-cases.
Whilst working today I came across a test helper function that required a few too many parameters. Debating weather to break the function up, I decided that an elegant solution would be to take advantage of ES2015 object deconstruction and produce a form of ‘Named Parameters’.