Created
April 18, 2018 08:50
-
-
Save doro/5503bdfe64edc60c2b584d95cd26d3ed to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/disecabazu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function dd(t){ console.log("dd: ", t);} | |
for (let i=1; i<=3; i++) { | |
console.log("first loop: ", i); | |
setTimeout(function() {console.log(i);}, 1000); | |
} | |
for (let i=1; i<=3; i++) { | |
console.log("2nd loop: ", i); | |
setTimeout(() => {dd(i);}, 2000); | |
} | |
let s; | |
for (let i=1; i<=3; i++) { | |
console.log("3rd loop: ", i); | |
s=i.toString(); | |
setTimeout(() => {dd(s);}, 2000); | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function dd(t){ console.log("dd: ", t);} | |
for (let i=1; i<=3; i++) { | |
console.log("first loop: ", i); | |
setTimeout(function() {console.log(i);}, 1000); | |
} | |
for (let i=1; i<=3; i++) { | |
console.log("2nd loop: ", i); | |
setTimeout(() => {dd(i);}, 2000); | |
} | |
let s; | |
for (let i=1; i<=3; i++) { | |
console.log("3rd loop: ", i); | |
s=i.toString(); | |
setTimeout(() => {dd(s);}, 2000); | |
} | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dd(t){ console.log("dd: ", t);} | |
for (let i=1; i<=3; i++) { | |
console.log("first loop: ", i); | |
setTimeout(function() {console.log(i);}, 1000); | |
} | |
for (let i=1; i<=3; i++) { | |
console.log("2nd loop: ", i); | |
setTimeout(() => {dd(i);}, 2000); | |
} | |
let s; | |
for (let i=1; i<=3; i++) { | |
console.log("3rd loop: ", i); | |
s=i.toString(); | |
setTimeout(() => {dd(s);}, 2000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment