Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <script>
- for (i = 0; i < 5; i++) {
- (function() {
- var j = i;
- var x = Math.floor(Math.random() * 20000);
- setTimeout(function () {
- // Log Result of i (increment) and x (time)
- console.log(j+" "+x);
- }, x);
- })();
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment