Please see the below code.
I thought the ‘11111111’ line would never be executed but it is.
Can anyone please explain.
function outer()
{
function inner(dur)
{
console.log('in inner');
setTimeout(() => {
outer();
console.log('11111111');
}, dur);
}
console.log('in outer');
inner(5000);
}
outer();
I expected an infinite loop. That happened.
But I never expected the ‘11111111’ to execute.