function uniqueElementOfArray(array) {
        function onlyUnique(value, index, self) {
        	return self.indexOf(value) === index;
      	}
        return array.filter(onlyUnique);
      }
      
      Javascript language logo

      Unique elements of array

      My JavaScript recipes

      Keep only unique elements of an array

      Shortcut: array.unique_elements

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.