Games Node.js Loop Quest Events and errors
await makes try/catch work
The same idea with a rejected promise, but awaited inside try/catch.
async function load() { try { await Promise.reject(new Error('nope')); } catch (e) { console.log('caught ' + e.message); } console.log('carry on');}load();console.log('sync');1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…