I am not able to understand how this recursion is going to work. Specifically, I'm not able to get a clear idea about how the last console
('end'---) is getting executed. Please provide guidance. Please help me on the execution part. I am not understanding how it is forming the output
function foo(i) {
if (i < 0)
return;
console.log('begin: ' + i);
foo(i - 1);
console.log('end: ' + i);
}
foo(3);