class Case { constructor(name = "Project", description = "This is a project.", url = undefined) { this.name = name; this.description = description; this.url = url; } } const CASES = [ ]; const casesButton = document.querySelector("button#cases-button"); const casesDiv = document.querySelector("div#cases"); if (casesButton && CASES.length > 0) casesButton.hidden = false; function showCases() { if (!casesButton) return console.log("k"); if (casesDiv.hidden) casesDiv.innerHTML = ""; casesDiv.hidden = !casesDiv.hidden; let list = document.createElement("ul"); CASES.forEach(c => { console.log(c); // a dirty hack :p list.innerHTML += `
  • <${c.url ? 'a' : 'span'} ${c.url ? 'href="' + c.url + '"' : ''}>${c.name} - ${c.description}
  • `; }); casesDiv.appendChild(list); } casesButton.onclick = showCases;