const links = [ { link: "https://google.com", title: "Google" }, { link: "https://facebook.com", title: "Facebook" }, { link: "https://github.com", title: "GitHub" }, { link: "https://youtube.com", title: "YouTube" } ] const rootDiv = document.querySelector("#root") for (let i = 0; i < links.length; i++) { const {link, title} = links[i] const aElem = document.createElement("a") // aElem.setAttribute("href", link) // aElem.innerText = title // {title} rootDiv.append(aElem) } a { margin: 0 5px; }