//get list of buttons and make sure there are no duplicates function displayButtons(){ const companies = products.reduce((total, item) => { total.push(item.company) total = [...new Set(total)] return total },['All']) const buttons = companies.map((item) => { return `<button class="company-btn">${item}</button>` }).join('') buttonsContainer.innerHTML = buttons } // or we could do this... const someBtns = ['all',...new Set(products.map((product) => product.company)),]; console.log(someBtns)