an web-app which displays quotes using api data
- its fetches the api and display the quotes in container.
- with the help of body tag and display (flex) properties i have centered both div and content.
- in javascript i used the DOM (Document Object Model) concept to display that data on a webpage.
document.addEventListener('DOMContentLoaded', function () {
fetch('https://random-api.xyz/api/fun/quote')
.then(response => response.json())
.then(data => {
const apiDataElement = document.getElementById('apiData');
apiDataElement.textContent = JSON.stringify(data.quote);
console.log(data);
})
.catch(error => {
console.error('Error fetching API data:', error);
});
});