This is my simple App
for(var i = 0 ; i < prod.length;i++ ){
var urls = prod[i].URL
urls = urls.split(" ")[0];
scrapeIt(urls, {
avatar: {
selector: ".image img"
, attr: "src"
}
}).then(async ({ data, response }) => {
// console.log(`Status Code: ${response.statusCode}`)
urli = "https://www.choithrams.com"+data.avatar
var name = prod[i].Name
var price = prod[i].price
console.log(name)
})
}
I want to get the result step by step but it is not iterating correctly. Secondly I, for example, I have a global variable outside and I want to overwrite its value from the one I get, I cannot simply do it.
the Result is
Mara Chopped Tomatoes Easy Open 400 gms
Mara Chopped Tomatoes Easy Open 400 gms
Mara Chopped Tomatoes Easy Open 400 gms
Mara Chopped Tomatoes Easy Open 400 gms
Mara Chopped Tomatoes Easy Open 400 gms
Mara Chopped Tomatoes Easy Open 400 gms
which is the last item in mineJSON. I am a beginner in all this kindly do help.