Async

fetch() API

Learn how to use fetch() API in JavaScript.

fetch() API

Documentation for fetch() API in JavaScript.

Syntax

fetch("/api/data").then(res => res.json())

Example

// Practical usage
fetch("/api/data").then(res => res.json())
console.log("Executed successfully.");

Notes

JavaScript provides powerful built-in methods for the web.

Try It Yourself

You can run JavaScript directly in the BrowserCode Playground.