I have an array, said arr
, and I need to iterate on it.
What I tried so far :
arr.forEach((rack) => {
request.post({
headers: {'content-type' : 'application/x-www-form-urlencoded'},
url: 'https://example.com/render',
body: "target=foobar"
}, function(error, response, data){
if (error) {
console.err(error);
} else {
console.log(JSON.stringify(data, null, 4));
}
});
});
I have no output, nor error.
Bonus question: Can I return a value from within the post in the global scope ?