30, filter array deduplication

eg:

  ARR = the let [1,0,0,9,7,7,5,2 ] 
  the let Data = arr.filter ((Item, index, Self) => 
        self.indexOf (Item) === index                
   ) 
            the console.log (Data) // [1,0,9,7,5,2] 
// the indexOf ( 'string') refers to the location of a specified string value of the first occurrence of the string

 

Guess you like

Origin www.cnblogs.com/xlfdqf/p/11313846.html