JSSM, a JavaScript state machine - the FSM for FSL
    Preparing search index...

    Function unique


    • Reduces an array to its unique contents. Compares with === and makes no effort to deep-compare contents; two matching arrays or objects contained will be treated as distinct, according to javascript rules. This also means that NaNs will be dropped, because they do not self-compare.

      unique( [] );                     // []
      unique( [0,0] ); // [0]
      unique( [0,1,2, 0,1,2, 0,1,2] ); // [0,1,2]
      unique( [ [1], [1] ] ); // [ [1], [1] ] because arrays don't match
      unique( [0,NaN,2] ); // [0,2]

      Type Parameters

      • T

      Parameters

      • arr: T[]

      Returns T[]