Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ANUPAMCHAUDHARY1117/e20fec0c4d923d87cd999f15d911871f to your computer and use it in GitHub Desktop.

Select an option

Save ANUPAMCHAUDHARY1117/e20fec0c4d923d87cd999f15d911871f to your computer and use it in GitHub Desktop.
const request = require("request");
function getTheUrl(data) {
var options = {
url: "https://jsonplaceholder.typicode.com/posts/" + data
}
return options
}
function consoleTheResult(url) {
request(url, function (err, res, body) {
console.log(url);
});
}
for (var i = 0; i < 10; i++) {
consoleTheResult(getTheUrl(i))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment