Skip to content
Advertisement

Tag: ecmascript-2017

ES7, ES8, ES9, ES10, ES11 Browser support

Regarding compatibility between ECMAScript specification and actual implementation; It is fairly easy to check out the data about browser support for ECMAScript2015 (ES6), but I found it pretty difficult to have an equivalently clear table for all the following ES versions (ES7+). By the time this question is asked: Mozilla has some info on their website: it is possible to

When to mark function as async

Basically, function must be prefixed with async keyword if await used inside it. But if some function just returns Promise and doesn’t awaiting for anything, should I mark the function as async? Seems like both correct or not? Answer if some function just returns Promise and doesn’t awaiting for anything, should I mark the function as async? I would say

Chain async functions

In an async function, I can get an asynchronous value like so: const foo = await myAsyncFunction() If I want to call a method on the result, with a sync function I’d do something like myAsyncFunction().somethingElse() Is it possible to chain calls with async functions, or do you have to assign a new variable for each result? Answer I prefer

How to use ES8 async/await with streams?

In https://stackoverflow.com/a/18658613/779159 is an example of how to calculate the md5 of a file using the built-in crypto library and streams. But is it possible to convert this to using ES8 async/await instead of using the callback as seen above, but while still keeping the efficiency of using streams? Answer The await keyword only works on promises, not on streams.

Advertisement