function error(message) { const errorContainer = document.getElementById("mao-error"); const errorElement = document.getElementById("mao-error-message"); errorElement.innerText = message; errorContainer.classList.remove("hidden"); } function displayResponse(response) { if (!response.ok) { error(response.error); return; } const { videos, total } = response; if (videos.length === 0) { error("search returned no results"); return; } console.log(videos); const resultElement = document.getElementById("result"); resultElement.innerHTML = `
Showing ${videos.length}/${total} results.
` + "