This is untested so it may need a bit of tweaking, but you could do
something like this:

// for each item in the array
for(var i = 0; i < workData.length; i++){

      // compare to all other array elements
      for(var j = 0; j < workData.length; j++){

            // do your comparison(s), making sure not to compare to itself
            if(workData[i].pm == workData[j].pm && i != j){

                  // overwrite the propeties of the first element with the
properties of the second
                  for(var props in workData[i]){
                        workData[i][props] = workData[j][props];
                  }

                  workData.splice(1,j);
            }
      }
}


Things to consider--
Will all elements in your array have the same properties?
Do you need more logic involved in figuring out which properties should be
the ones to keep?


Jason Van Pelt
Interactive Developer
504.210.1232 (p) / 504.581.2731 (f)
Peter A. Mayer Advertising, Inc.
www.peteramayer.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to