[![enter image description here][1]][1]I am trying to throw an exception from setTimeout within the try block.
See Below Code
let a = 2 + 2;
if (a == 4) {
setTimeout(() => {
console.log('Set time out')
throw new Error()
}, 3000)
}
else {
console.log('Not 4')
}
} catch (error) {
console.log('catch block')
console.log(error)
}```
But the control cannot come to the catch block and I am unable to see the result from console.log('catch block').
[1]: https://i.stack.imgur.com/3DdhB.png