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

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

compare two arrays and make sure there are no duplicates js

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

PREVIOUS NEXT
Code Example
Javascript :: relaod the page in express 
Javascript :: react state hooks 
Javascript :: bootstrap prevent dropdown from closing on click 
Javascript :: next js absolute path 
Javascript :: settimeout in vuejs 
Javascript :: input to state 
Javascript :: react scroll reset in component 
Javascript :: javascript check if number is hexadecimal 
Javascript :: angular dynamic class 
Javascript :: copy to clipboard js 
Javascript :: axios get status code 
Javascript :: javascript assert 
Javascript :: jquery format date 
Javascript :: uuid timestamp in javascript 
Javascript :: how to test on user reaction discord.js 
Javascript :: react native detect swipe 
Javascript :: javascript find 
Javascript :: eslintrc ignore rule 
Javascript :: nestjs version 
Javascript :: angular production vs development mode 
Javascript :: update file json trong javascript 
Javascript :: javascript try catch 
Javascript :: how to convert string to lowercase in javascript 
Javascript :: convert date online in moment js 
Javascript :: javascript sessionstorage 
Javascript :: check all values from keys in object js 
Javascript :: disable button click jquery 
Javascript :: convert response to json javascript 
Javascript :: javascript replace 
Javascript :: jquery scrollheight 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =