Simple question about try-catch for function in setTimeout
try { setTimeout(function () { throw new Error(\'error!\'); }, 300) } catch (e) {
Because the catch block lexically surrounds the setTimeout call but that is not the function that throws. The direct translation, is
setTimeout
setTimeout(function () { try { throw new Error('error!'); } catch (e) { console.log('eeee!'); console.log(e); } }, 300);