Can anyone help me identify the issue I am facing with this particular line...
newIndustry.innerHTML = industryNews[generateRandomNumber()-1]
}
I am using this JavaScript code to insert text into a heading element with #industryNews
:
var industryNews = [];
industryNews[0] = "Lorem ipsum dolor <strong>sit</strong> amet, consectetur adipisicing elit. Optio, ut, maxime, eum, fugit dolor nulla cupiditate beatae sapiente dignissimos accusamus cumque fuga alias accusantium praesentium nisi placeat quam ad eius.";
industryNews[1] = "Lorem ipsum dolor <strong>sit</strong> amet, consectetur adipisicing elit. Provident, consequuntur, officia veritatis molestias odio nobis minima iste id tenetur possimus magni nisi error enim minus aperiam? Minus, iure delectus cumque.";
industryNews[2] = "Lorem ipsum dolor <strong>sit</strong> amet, consectetur adipisicing elit. Sint, in, qui voluptatibus voluptas inventore recusandae non quos adipisci dolor beatae dolore saepe quaerat exercitationem dolores delectus quo pariatur. Quae, quidem.";
industryNews[3] = "Lorem ipsum dolor <strong>sit</strong> amet, consectetur adipisicing elit. Assumenda, sed, laborum, quisquam rerum quo non aspernatur necessitatibus soluta id debitis impedit corporis magnam praesentium ab odit dicta aperiam autem consequuntur!";
var newIndustry = document.getElementById("industryNews");
// function to generate a random number between 1 and 4
function generateRandomNumber(){
return Math.floor(Math.random()*(4)+1);
}
function updateindustryNews () {
newIndustry.innerHTML = industryNews[generateRandomNumber()-1]
}
updateindustryNews();
setInterval(updateindustryNews,4000);