const xx = [" 4", "9", "16"," 4", "9", "16"," 4", "9", "16"] <ul> {(<li> {[...new Set(xx)]} </li>)} </ul>constante xx = [" 4", "9", "16"," 4", "9", "16"," 4", "9", "16"]
Aquí, esto funcionaría bien
const xx = [" 4", "9", "16"," 4", "9", "16"," 4", "9", "16"]; const set = [...new Set(xx)]; let html = ''; set.forEach(el => { html += `<li>${el}</li>`; }); document.querySelector("#list").insertAdjacentHTML('afterbegin', html); <ul id="list"></ul>También podría hacer lo mismo con los métodos de matriz
const xx = [" 4", "9", "16"," 4", "9", "16"," 4", "9", "16"]; const html = [...new Set(xx)].map(el => `<li>${el}</li>`).join(''); document.querySelector("#list").insertAdjacentHTML('afterbegin', html); <ul id="list"></ul>