I’m confused as why one, two and three are printed even after encountering an error.
Here’s the code:
setTimeout(() => {
console.log("one");
}, 1000);
setTimeout(() => {
console.log("two");
}, 2000);
setTimeout(() => {
console.log("three");
}, 3000);
console.log(neha);
I was expecting just an error without printing set timeout values as per my knowledge js engine runs console.log first and then set timeout after their particular timeframe. Correct me if I am wrong and I am new to Stackoverflow too. It’s my first question.