You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is what I've written for Async Juggling. Could anyone explain why it doesn't work?
`var http = require('http');
const url1 = process.argv[2];
const url2 = process.argv[3];
const url3 = process.argv[4];
function GetData ( url, callback ) {
http.get(process.argv[2], function (response) {
var str = '';
response.on('data', function(data) {
str += data.toString();
})
response.on('end', function() {
callback(str);
})
});
}
Here is what I've written for Async Juggling. Could anyone explain why it doesn't work?
`var http = require('http');
const url1 = process.argv[2];
const url2 = process.argv[3];
const url3 = process.argv[4];
function GetData ( url, callback ) {
http.get(process.argv[2], function (response) {
var str = '';
response.on('data', function(data) {
str += data.toString();
})
response.on('end', function() {
callback(str);
})
});
}
GetData (url1, function(err, data) {
if (err) {
console.log(err);
}
else {
console.log(data);
GetData (url2, function(err, data) {
if (err) {
console.log(err);
}
else {
console.log(data);
GetData (url3, function(err, data) {
if (err) {
console.log(err);
}
else {
console.log(data);
}
});
}
});
}
});`
Thanks
Manmeet
The text was updated successfully, but these errors were encountered: