Lesson 4 of 6
Promises
A Promise represents a value arriving later (API response, timer…). .then(callback) chains the processing once it resolves.
fetchScore() is provided and simulates an API call: it returns a Promise — the handling code is identical to a real fetch.
fetchScore().then((score) => {
console.log(score);
});🎯 Exercise
Call fetchScore() (provided), then inside the .then, write the score multiplied by 10 into #out (expected result: 70).
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →