Thank yall in advance.
Hi there, I think you will understand this better when you work on a hands-on project. In my case, I recently followed a tutorial on creating a quote generation web app using JS.
So, I wrote a function to get data from an API. I turned the data to JSON, so each quote was an object. Thereafter, I assigned the object to a variable and updated the div containing the quote using this variable.
Check out this git repo: GitHub - rubenjen/quote_generating_machine
The script.js file is especially useful to show what I just said.
Hope this helps.
NB: This isn’t my original idea, I followed a tutorial, not sure by whom…