Last active
July 1, 2016 14:48
-
-
Save rexcfnghk/a4a1c9898e6239b97ba7659d1e6ef76a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var http = require('http'); | |
| function makeResponseHandler(i) { | |
| return function(response) { | |
| console.log('i: ' + i); | |
| }; | |
| } | |
| var i = 0, | |
| urls = [ 'http://www.google.com', 'http://www.yahoo.com' ], | |
| urlLength = urls.length; | |
| for (; i < urlLength; i++) { | |
| http.get(urls[i], makeResponseHandler(i)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment