I have an array of objects that contains a key value with true or false. These values start as false but switch to true on completion of their work. I was looking to determine when all the values had completed i.e. all switched to true. Is there a deviation(logic below) on a while loop with a test if statement that may solve this.
basicarray = [{"value" : false}, {"value" : false},
{"value" : false}, {"value" : false},
{"value" : false} ];
non working logic
totalcount = 0;
while(totalcount < basicarray.length )
{
for(a=0 ; a < basicarray.length; a++)
{
if(basicarray[a].value = true)
{
totalcount = totalcount + 1;
}
}
}
alert("all true");