Created
February 8, 2026 13:54
-
-
Save vanaf1979/c41a24a293884b12c4cd97f8112749ec to your computer and use it in GitHub Desktop.
Fetch basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Mark the function as async | |
| const fetchStarTrekData = async () => { | |
| // 2. The first 'await' waits for the initial response (headers) | |
| const response = await fetch('https://api.since1979.dev/characters'); | |
| // 3. The second 'await' waits for the full body to be parsed as JSON | |
| const data = await response.json(); | |
| // Now the data is ready to be used | |
| console.log(data); | |
| }; | |
| fetchStarTrekData(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment