Below is a piece of working code. The "= true" part is confusing to me. This is what I think is happening.
1- create empty array.
2- take the selected list items (targets) and loop.
3- if the class attributes for the target list item is not in the array then enter if block.
4- add the class attributes for the target list item and add them
to the array.
My understanding is that javascript uses "push" and jquery uses "add" to insert items into an array. The code below does not use push or add.
var foo = [];
$($targets).each(function(i) {
if (!foo[$(this).attr('class')]) {
foo[$(this).attr('class')] = true;
}
});