Removing duplicate strings using javascript
<p>I have an array of 800 sentences. I want to remove all duplicates (sentences that have the same exact words, but in different order) from the array. So for example "this is a sentence" and "is this a sentence" are duplicates. Only one one of them should remain in the array (it doesn't matter which one). </p>

<p>My first idea was to copy them one by one to a new array, each time checking to see if the sentence already exists in the new array. I would accomplish this by looping through all the elements in the new array and using the following code for comparing the sentences: </p>

<p><a href="http://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arrays">Using jQuery to compare two arrays</a></p>

<p>However, this quickly becomes too intensive in terms of calculations and causes the javascript engine to be nonresponsive. </p>

<p>Any ideas on how to make the algorithm more efficient would be appreciated. </p>
