Output: try/catch around a throwing setTimeout and around an un-awaited rejecting async call
MediumP2Output
What does this code print? Neither try block is aborted by a thrown error that it cannot see.
1try {2 setTimeout(() => {3 throw new Error('in timer');4 }, 10);5} catch (e) {6 console.log('caught timer');7}89async function fail() {10 throw new Error('in async');11}12try {13 fail();14} catch (e) {15 console.log('caught async');16}17console.log('end of script');
Saved automatically
One line per console.log. Arrays as [1, 2, 3], objects as { a: 1 }, an uncaught error as Uncaught TypeError: message (Chrome and Node wording).
Hints
Saved automatically