How to stop adding the same words, that <element> already has

How to stop adding the same words, that <element> already has

 

Well, I start from gathering 7 values from 7 <tr>'s:
name 1
name 2
name 3
name 4
name 4
name 5
name 6

  1.  var names = $("tbody tr").map(function(ind, obj){    
  2.     return $(this).children().eq(3).text();
  3.   });

But I need to remove duplicates, such as name 4
How can I do that?


This code doesn't work for preventing text duplicates:
  1.   $("span#complex").text(
  2.     $.map(names, function(obj, ind){
  3.       if( $("span#complex").is(":contains(names[ind])") )
  4.         return;
  5.       else
  6.         return names[ind];
  7.     }).join(", ")
  8.   );