Closures:
1. First Loop (with differentScope function):
for(var i=1;i<=5;i++){
const differentScope = (i)=>{
setTimeout(()=>{
console.log(i)
},i*1000);
}
differentScope(i);
}
Output: 1 2 3 4 5 (each number printed at 1-...
cleanclosure.hashnode.dev2 min read