Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js unique string array

const uniqueStrArr = (value, index, self) => {
  return self.indexOf(value) === index;
}

// usage example:
var arr = ['a', 1, 'a', 2, '1'];
var unique = arr.filter(uniqueStrArr);

console.log(unique); // ['a', 1, 2, '1']
Comment

PREVIOUS NEXT
Code Example
Javascript :: Error occurred while trying to proxy to: localhost:3000/ 
Javascript :: delete space from string javascript 
Javascript :: typescript react handle change 
Javascript :: innertext of element js 
Javascript :: java object to json 
Javascript :: spread operator in javascript 
Javascript :: Environment key "jest/globals" is unknown - react 
Javascript :: express js delete request 
Javascript :: Validate email or phone number javascript 
Javascript :: js check if string is int 
Javascript :: useisfocused react navigation 
Javascript :: this.handler.handle is not a function 
Javascript :: sequelize left join attributes 
Javascript :: delete row in html table using javascript 
Javascript :: immediately invoked function expression 
Javascript :: html select specify deafult select by js variable 
Javascript :: javascript to array 
Javascript :: The document.getElementById() Method 
Javascript :: joi validation enum 
Javascript :: react select disable option 
Javascript :: deleteone mongoose 
Javascript :: js fetch queryselector 
Javascript :: what is redux 
Javascript :: cypress graphql request 
Javascript :: jest Your test suite must contain at least one test. 
Javascript :: js get all arguments from function 
Javascript :: slide hide animaition in react 
Javascript :: javascript object destructing 
Javascript :: how to redirect react router from the app components 
Javascript :: run code snippet 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =