javascript dedupe array
const names = ['John', 'Paul', 'George', 'Ringo', 'John'];
let x = (names) => names.filter((v,i) => names.indexOf(v) === i)
x(names); // 'John', 'Paul', 'George', 'Ringo'
var data = [1, 2, 'Peter', 3, 3,'Peter', 2, 2, 1, 2, 3, 4, 4, 5, 4];
var unique = data.filter((v, i, a) => a.indexOf(v) === i);
Also in JavaScript:
- check if date equal js
- js how to know if element touch border
- Parallax.js wrapper for react
- state in react
- javascript create array from 1 to n
- discord js bot embed user profile picture
- chroma js contrast check
- web worker multiple data
- Error: open failed: EACCES (Permission denied) react native
- jquery label with text
- detect browser javascript
- sars
- anagram program in javascript
- vue lifecycle
- Find a vowel at the begining and end with regular expression
- update object within object by id js
- react json object pretty
- change true to false js
- jquery detect nav tab change event
- sum all the values in an array javascript
- Javascript format to currency
- aos animation
- toLocalString
- angular random number between 1 and 10