compare two array value and remove the duplicate value and store another array lodash
问题 how to compare two array value and remove the duplicate value and store another array using lodash for example var array1=['1', '2', '3', '4'] var array2=['5', '1', '8', '10', 3] var result = ['2','4','5','8','10'] 回答1: Just concat the arrays and check the indices from left and right side. If equal, take the unique value. This solution takes only '3' for both arrays. var array1 = ['1', '2', '3', '4'], array2 = ['5', '1', '8', '10', '3'], result = array1.concat(array2).filter((v, _, a) => a