Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!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">
- var a = {
- counter: 0,
- b: {
- c: {
- d: function() {
- for (var i=0;i<5;i++) {
- setTimeout(function() {
- console.log(i, ++this.counter);
- }, 500);
- }
- }
- }
- }
- };
- a.b.c.d();
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">var a = {
- counter: 0,
- b: {
- c: {
- d: function() {
- for (var i=0;i<5;i++) {
- setTimeout(function() {
- console.log(i, ++this.counter);
- }, 500);
- }
- }
- }
- }
- };
- a.b.c.d();
- </script></body>
- </html>
Add Comment
Please, Sign In to add comment