I iterate a loop within another loop, based on the same array, what's the best way to ignore duplicates?
<p>I want to save all combinations of an array. So for
[a, b, c] I want to save
[ab, ac, ba, bc, ca, cb]</p>

<p>I currently use this method:</p>

<pre><code>for (coordinate in coordinates){
    for (coordinate2 in coordinates){
        if (coordinate != coordinate2){
            newposts.push([fbposts[fbpost].id, coordinates[coordinate], coordinates[coordinate2]]);
        }
    }
}
</code></pre>

<p>but it generates a bunch of duplicates. What's the smoothest way to solve this?</p>
