var car = ["Saab","Volvo","BMW","Saab","BMW",]; var cars = [...new Set(car)] document.getElementById("demo").innerHTML = cars;