Skip to content

Instantly share code, notes, and snippets.

@monirshimul
Created February 20, 2020 08:46
Show Gist options
  • Select an option

  • Save monirshimul/af801ea51bb84a7ec6fc4763832f54ed to your computer and use it in GitHub Desktop.

Select an option

Save monirshimul/af801ea51bb84a7ec6fc4763832f54ed to your computer and use it in GitHub Desktop.
function a(){
for (var i = 0; i<=10; i++){
var a = setTimeout(()=>{
var a = 10
},1000)
var a = setTimeout(()=>{
var a = 11
},2000)
var a = setTimeout(()=>{
var a = 12
},3000)
console.log("This is from A :",a)
}
b()
}
function b(){
for (var i = 0; i<=10; i++){
var a = setTimeout(()=>{
return 10
},1000)
var a = setTimeout(()=>{
return 11
},2000)
var a = setTimeout(()=>{
return 12
},3000)
console.log("This is from B :",a)
}
}
a()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment