Answers for "callback without duplicates javascript"

0

callback without duplicates javascript

function myFunction(myArray, callBack){

 var unique = myArray.filter(function(item, pos) {
   //validates whether the first occurrence of current item in array
   // equals the current position of the item (only return those items) 
   return myArray.indexOf(item) == pos;
 });

 //wrap your result and pass to callBack function 
 callBack(unique);

}
Posted by: Guest on January-22-2020

Code answers related to "callback without duplicates javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language