SKU_list.forEach(function(item, i, SKU_list) { request(url.replace("change", item), function(error, response, body) { jsonfile.writeFile(item + ".json", response.body, function(err) { console.log(item); }); }); }); 

Help please, there is a cycle, how can I make a request in it?
Rekvest without a cycle works fine. But when I insert it inside forEach the request returns undefined . How to solve this problem?

  • Where looked that the request began to return undefined ? - Grundy
  • SKU_list what's in it? can throw an example what values? - Andrey Simanovich

0