'use strict'; // eslint-disable-next-line no-unused-vars class Util { static createAndAppend(name, parent, options = {}) { const elem = document.createElement(name); parent.appendChild(elem); Object.keys(options).forEach((key) => { const value = options[key]; if (key === 'text') { elem.innerText = value; } else { elem.setAttribute(key, value); } }); return elem; } static fetchJSON(url) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.responseType = 'json'; xhr.onload = () => { if (xhr.status < 400) { resolve(xhr.response); } else { reject(new Error(`Network error: ${xhr.status} - ${xhr.statusText}`)); } }; xhr.onerror = () => reject(new Error('Network request failed')); xhr.send(); }); } }