I' trying to use fetch to access data in other file but it keeps return
ReferenceError: fetch is not defined
const getData = async () => {
const fetchedData = await fetch("./dino.json");
const data = await fetchedData.json();
return data.Dinos;
};
getData().then(data => {
console.log(data); // will print the array
}).catch(error => {
console.error(error);
});
I am looking at this fetch API but it did not specify that if we need install anything