This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
const arr = [1, 2, 3, 4, 5, 6]; | |
async function main() | |
{ | |
/** If this block is uncommented, all 6 lines print at the same time, | |
* after "Done" is printed, even if the forEach is awaited. Nothing awaits | |
* the individual Promises created for each element. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Do a thing poorly and asynchronously | |
async function doAThingBadly() { | |
throw new Error('It broke') | |
} | |
// node uncaught.js | |
// Try to await a thing. It will throw, but it seems like the Error | |
// should bubble up to be caught in the higher-up try-catch, right? Right? | |
async function doAThing() { |