Article From:https://segmentfault.com/q/1010000011704428
Question:

What is the reason for this?

var http = require('http');
var urls = ['http://www.runoob.com/', 'http://www.hubwiz.com/', 'http://www.saylove.com/']
function fetchPage(url) {
    http.get(url, function(res) {
        console.log("You have successfully requested "URL".})}For (VaR I = 0; I < urls.length; i++) {FetchPage (I)}

Answer 0:

You are hereiIt’s index. To loop, it should be passed in the function.urls[i]That’s all right.

Answer 1:
for(var i = 0;i < urls.length;i++) {
//I is the number here! It should be introduced to URL.FetchPage (I)}

Similar Posts:

Link of this Article: Http.get () reported wrong in node

Leave a Reply

Your email address will not be published. Required fields are marked *