rbi-learning / Today-I-Learned

1 stars 0 forks source link

Today I Learned (August 4th) #59

Open farhan310 opened 4 years ago

farhan310 commented 4 years ago

Today I learned about the Asynchronous function. async means that events happen in order, one waits for another to end, as opposed to synchronous, which all happens at the same time.

Additionally, we also learned about the Fetch function which allows us to 'fetch' data from different APIs and sources instead of hard coding data. This can be utilized by fetching data from our own files such as the json file we worked on today.

Here is an example of the notation we used in order to fetch data from a json file:


const response = await fetch('./data.json');
const data = await response.json();
document.title = data.name;```