Back to JavaScript

JavaScript Tutorial

APIs and Fetch

Request data from APIs using the Fetch API.

APIs let applications exchange data with servers and services.

The fetch function is commonly used to request and send data from the browser.

javascript
fetch("https://api.example.com/posts")
  .then((response) => response.json())
  .then((posts) => console.log(posts));