I have this drop-down menu. My goal is to transfer the elements of an array as choices on the drop-down menu. However, I want repeating array elements to be copied to the drop-down only once. I'm looking for transferring my array to another array without repetition. So, I can rather use that new array to transfer its element to the drop-down menu. For example, on the drop-down menu, the "kg" and "lbs" would only exist once instead of twice.
amountType = document.getElementById("amount-type");
arr = ["kg", "medium", "lbs", "liter", "kg", "small", "lbs"];
for (let i = 0; i < arr.length; i++) {
let el = document.createElement("option");
el.textContent = arr[i];
el.value = arr[i];
amountType.appendChild(el);
}
<select id="amount-type"></select>