let array1 = ["apple", "banana", "mango"];
let array2 = ["apple", "banana", "mango", "red", "green"];
I want output is = array3 = [ "red", "green"];
I want to concat array1 and array2 and remove the duplicate code and output is array3.
There are two common ways (in ES5 and ES6, respectively) of getting unique values in JavaScript arrays of primitive values. Basically, in ES5, you first define a distinct callback to check if a value first occurs in the original array, then filter the original array so that only first-occurred elements are kept.