Only add element to array if it isn't already included
Target array element will be added to
Unique element to add
Array with element if it was unique
const arr = addUnique([1, 2, 3], 3);console.log(arr); // Output: [1, 2, 3] Copy
const arr = addUnique([1, 2, 3], 3);console.log(arr); // Output: [1, 2, 3]
Use ASet to create unique arrays
Only add element to array if it isn't already included