Remove duplicates from an array

How can I remove duplicate values from an array. At the end I load the results into a dropdown, but there are many duplicates.

export function dropdownMeets_change(event) {
getMeet()
.then(meet => {
var Sessions = ;
var Teams = ;

//Loop through all the meets in the details.
for ( let i = 0; i < meet.length; i++) {

//if the selected meet is found, add to sessions and teams array
if ($w(“#dropdownMeets”).value === meet[i].meets_id) {
//console.log("IN: " + meet[i].meets_id + " " + meet[i].session + " " + meet[i].teams);
Sessions[i] = {
label: "Session " + meet[i].session,
value: meet[i].id
};

                Teams[i] = { 
                    label: meet[i].Teams, 
                    value: meet[i].id 
                }; 
            } 
        } 
        $w("#dropdownSession").options =Sessions; 
    }); 

}

Hi, AJ.

Wouldn’t the best way to eliminate duplicates be to not introduce them in the first place?

Do you have access to/control of the code in the getMeet() method?

This should help: Remove duplicates from connected dropdown options

Hi AJ,
I had a similar issue, to remove duplicates from my dataset and populate it in a dropdown. Eventually, I successfully implemented it. You can check out this step-by-step example .
Good luck!
Ben