class commentsDisplay extends HTMLElement { constructor() { super(); let path = window.location.pathname; let pageName = path.split("/").pop(); pageName = pageName.split(".")[0] let xhr = new XMLHttpRequest(); xhr.onreadystatechange = () => { if (xhr.readyState === 4 && xhr.status === 200){ let comments = JSON.parse(xhr.responseText); comments.forEach((element) => { this.innerHTML += `
${element["comment"]}