function getInfo() {
fetch("https://swapi.co/api/people")
.then(response => response.json())
.then(function(data) {
console.log(data);
})
.catch(function(error) {
// If there is any error you will catch them here
console.log(error);
});
}
const newPerson = document.getElementById('newQuote')
newPerson.addEventListener('click', getInfo); // new quote on button click
window.onload = getInfo; // new quote on page load
I wrote this code and in console I got the following message: TypeError{}