Prog with let
function printNumAfterXSeconds()
{ for(let i =1 ; i<= 5; i++)
{ setTimeout(function()
{ console.log('i is', i);
}, i*1000);
}
}
o/p: 1,2,3,4,5
Reason: let i inceamented by 1
and closure has ref to i
let keyword makes sure that i has block scope