}, { } ]; function getRandomAd() { var randomIndex = Math.floor(Math.random() * ads.length); return ads[randomIndex]; } function displayAd(ad) { adImage.src = ad.image; adDescription.textContent = ad.description; adDescription.style.display = 'none'; adContainer.addEventListener('click', function() { adDescription.style.display = adDescription.style.display === 'block' ? 'none' : 'block'; }); } window.onload = function() { var randomAd = getRandomAd(); displayAd(randomAd); };