Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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'
Comment

PREVIOUS NEXT
Code Example
Javascript :: reference error $ is not defined jquery 
Javascript :: how to create infinite loop in javascript 
Javascript :: js background 
Javascript :: repeat react component n times 
Javascript :: first day of month and last day of month moment js 
Javascript :: array methods javascript 
Javascript :: FAILURE: Build failed with an exception react native android 
Javascript :: how to set/get cookie in JavaScript 
Javascript :: adding binary numbers in javascript 
Javascript :: install gulp ubuntu 20.04 
Javascript :: get number from range line js 
Javascript :: search if value exists in object javascript 
Javascript :: html2pdf cdn 
Javascript :: padstart and padend javascript 
Javascript :: javascript deep clone 
Javascript :: sort json in descending order 
Javascript :: return random rows sqlite 
Javascript :: splidejs autoscroll 
Javascript :: javascript get distinct values from array 
Javascript :: jquery download image from url 
Javascript :: javascript traverse 
Javascript :: fatal error: ineffective mark-compacts near heap limit allocation failed – javascript heap out of memory 
Javascript :: settime out with promise 
Javascript :: hide and show modal in jquery 
Javascript :: how to check if browser tab is active javascript 
Javascript :: map to array javascript 
Javascript :: javascript if field exists 
Javascript :: d3.json() function 
Javascript :: disable eslint 
Javascript :: how to find closest img tag in jquery 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =