To fetch a user we need: fetch('https://api.github.com/users/USERNAME'). A simple test: First we give the button event listener, then inside it we fetch the data, after that you could alternatively console.log it first to see all the data you receive from the API, and then we assigned the image variable a source that referencing to the data that we just received. For example, we can use a network request to: And all of that without reloading the page! Start Fetching LocalData! Is there any better way to do than what I am doing above? The generic syntax skeleton looks like this: The constructor takes two objects as parameters. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Very simple, nothing fancy here. We've already shown examples of using ReadableStreamDefaultController.close() to close a reader. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Templates let you quickly answer FAQs or store snippets for re-use. It has a number of advantages, and what is really nice about it is that browsers have recently added the ability to consume a fetch response as a readable stream. Just inside the