Script Valley
JavaScript Tutorial for Beginners to Advanced
Async JavaScript: Promises, Async/Await, and Fetch API/Assessment

Practice & Assessment

Test your understanding of Async JavaScript: Promises, Async/Await, and Fetch API

Multiple Choice Questions

5
1

What does an async function always return?

2

What does Promise.all() do when one of the promises rejects?

3

Why should you check response.ok after a fetch() call?

4

How do you handle errors in an async/await function?

5

What is the correct way to run two fetch calls in parallel using async/await?

Coding Challenges

1
1

GitHub Profile Viewer

Build an HTML page with an input field for a GitHub username and a Search button. When clicked, use the GitHub public API (https://api.github.com/users/{username}) to fetch the user's profile. Display their avatar, name, bio, public repos count, and followers count in a card. Handle loading state (show a spinner or text), invalid usernames (404 response), and network errors gracefully.

Medium
GeeksForGeeks

Mini Project

1

Weather Application Using OpenWeatherMap API

Build a weather app that accepts a city name from the user. Use the OpenWeatherMap API (free tier) to fetch current weather data. Display: city name, temperature, weather description, humidity, wind speed, and a weather icon. Add a recent searches list that shows the last five cities searched. Handle all error cases: invalid city, empty input, network failure. Use async/await throughout and update the DOM dynamically. Style the card to match the current weather condition (sunny, cloudy, rainy).

Hard