Im trying to check intersection between two sets and insert into an array or a new set, but without success here is what I wrote
let intersection=[] ; let a40=[1,2,3,5]; let a50=[1,20,30,5]; let unique1 = [new Set(a40)]; //console.log(unique1); let unique2 = [new Set(a50)]; // console.log(unique2); for (var i = 0; i < unique1.length; i++) { if (unique1[i] in unique2 ) { intersection.push(unique1[i]); } else{ //no } console.log(unique2); } https://stackoverflow.com/questions/66775061/javascript-find-intersection-beween-two-sets March 24, 2021 at 01:06PM
没有评论:
发表评论