This may be a question without any R&D but I am on a busy schedule and very new to these callback functions, The problem is I am getting a json payload from a webapp and I am trying to parse it , so this payload has a array of objects , but when i use this in my script i am getting only the last array index value. below is the code and attached console output for reference , please suggest where i am going wrong
var case1 = payload.Case;
var i=0;
for(i=0;i<case1.length;i++)
{
var c1 = case1[i];
c1.retrieveAttributes(function(){
console.log(i+ " i");
console.dir(c1.attributes);
});
}
The i value in console is always 6.