1
I created a javascript code where shows me several Andom texts, but these only change with the refresh of the page.
And I wanted them to change every five seconds without doing refresh.
Javascript:
(function() {
var quotes = [
{
text: " HEY ITS ME",
},
{
text: " HEY YOU TO",
}
];
var quote = quotes[Math.floor(Math.random() * quotes.length)];
document.getElementById("quote").innerHTML =
'<i class="fas fa-graduation-cap"></i> ' + quote.text + '';
})();
Why an array of objects and not an array of
strings
?– Isac