jsquotes/app.js
2022-05-18 00:14:26 -05:00

12 lines
340 B
JavaScript

const disp = document.querySelector(".display");
fetch("FavouriteQuotes.json")
.then((response) => {
return response.json();
})
.then((data) => {
numQuotes = Object.entries(data).length;
num = Math.floor(Math.random() * numQuotes);
disp.innerText = data[num].quote + "\n\n" + data[num].author.replace(/"/g, '');
})