JavaScript Promise.then() Explained

JavaScript Logo

Promise.then() – Handles the fulfilled result of a promise. You can chain `.then()` calls to perform sequential actions.

๐Ÿ‘‰ Syntax

promise.then(result => {
  // handle result
});

๐Ÿงช Example

fetch('https://api.example.com')
  .then(res => res.json())
  .then(data => console.log(data));

Comments