jsquotes/public/app.js

12 lines
364 B
JavaScript
Raw Normal View History

2023-01-22 10:03:28 -06:00
const disp = document.querySelector(".display");
fetch("https://cdn.fyrfli.link/FavouriteQuotes.json")
2023-01-22 10:03:28 -06:00
.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, '');
})