[ES2018] Two ways to write for-await-of
2018-02-25 01:47
621 查看
// Asynchronous iteration --> Symbol.asyncIterator async function main() { const syncIterable = [ Promise.resolve('a'), Promise.resolve('b'), ]; for await (const x of syncIterable) { console.log("x", x); // a, b } for (const s of await Promise.all(syncIterable)) { console.log("s", s); // a, b } } main();
相关文章推荐
- Passing address of non-local object to __autoreleasing parameter for write-back
- Write Code As If You Had to Support It for the Rest of Your Life
- Ten Ways to Check if an Integer Is a Power Of Two in C
- Given two strings s and t, write a function to determine if t is an anagram of s.
- Passing address of non-local object to __autoreleasing parameter for write-back
- Two ways to get HtmlTextWriter for HTML rendering
- Given two strings s and t, write a function to determine if t is an anagram of s.
- Ten Ways to Check if an Integer Is a Power Of Two in C
- 1.3 Given two strings, write a method to decide if one is a permutation of the other.
- Your task is to find for a given phone number any of its divisions into groups of two or three digit
- Write one line C function to find whether a no is power of two
- Given an integer, write a function to determine if it is a power of two
- Write Code As If You Had to Support It for the Rest of Your Life
- Write Code as If You Had to Support It for the Rest of Your Life
- Two ways to get HtmlTextWriter for HTML rendering
- Passing address of non-local object to _autoreleasing parameter for write-back
- Two ways to get HtmlTextWriter for HTML rendering
- Data Structure Linked List: Write a function to get the intersection point of two Linked Lists.
- two ways to hold the states of a job in ironic
- How to re-write 2D OpenGL app for OpenGL ES?