Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript merge two lists without duplicates

const array1 = ['a','b','c'];
const array2 = ['c','c','d','e'];
const array3 = [...new Set([...array1,...array2])];
console.log(array3); // ["a", "b", "c", "d", "e"]
Comment

javascript remove duplicate in two arrays

array1 = array1.filter(function(val) {
  return array2.indexOf(val) == -1;
});
// Or, with the availability of ES6:

array1 = array1.filter(val => !array2.includes(val));
Comment

merge array no duiplicates js

let array1 = ['a','b','c'];
let array2 = ['c','c','d','e'];
let array3 = array1.concat(array2);
array3 = [...new Set([...array1,...array2])]; // O(n)
Comment

PREVIOUS NEXT
Code Example
Javascript :: onclick cloSe tab in jquery 
Javascript :: javascript get date without time 
Javascript :: js self executing anonymous function 
Javascript :: avaScript slice() With Negative index 
Javascript :: count 1 to 5 javascript 
Javascript :: how to add keyboard shortcuts javascript 
Javascript :: scrolltop top to bottom body get count 
Javascript :: jquerygrid disable sorting 
Javascript :: random string generator node js 
Javascript :: pass keyword in javascript 
Javascript :: input type number react native 
Javascript :: js json download 
Javascript :: alphabetical order array javascript 
Javascript :: how to check file extension in node js 
Javascript :: append to array check if exists javascript 
Javascript :: display block class javascript 
Javascript :: express js basic example 
Javascript :: input type text js 
Javascript :: jquery redirect to url 
Javascript :: map dictionary javascript 
Javascript :: check a checkbox jquery 
Javascript :: js fullscreen 
Javascript :: javascript change url without reload 
Javascript :: alphabet letters in js code 
Javascript :: c# get value from json object 
Javascript :: disable split screen react native 
Javascript :: get all rooms socket.io 
Javascript :: js date format dd/mm/yyyy 
Javascript :: jquery radio button checked event 
Javascript :: jasmine check if service was called only once 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =