Good day,
I'm facing a challenge in Parse Javascript where I am trying to save items after receiving them in a loop. However, outside the loop, the array of objects remains empty.
.. define global ** var filesUpload = []**
for (var key in files) {
var photoUpload = new Parse.File(String(file.name),[file.image])
photoUpload.save().then(function(item) {
deferred.resolve(item)
filesUpload.push(deferred.promise)
}, function(error) {
console.log("error to save file"+JSON.stringify(error))
// The file either could not be read, or could not be saved to Parse.
})
}
--> end of loop
filesUpload array still has no items