var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];
// Create a set to store the unique elements of the array.
const uniqueNames = new Set(names);
// Get the array of elements in the set.
const newNames = Array.from(uniqueNames);
console.log(newNames); // ["Adam", "Jenny", "Carl", "Mike", "Matt"]