JavaScript is a high-level, dynamic, and interpreted programming language that is commonly used in web development. It allows developers to create interactive elements and dynamic effects on web pages.
The Fetch API provides a JavaScript interface for accessing and manipulating parts of the protocol, such as requests and responses. The Fetch API also provides a global fetch()
method that provides an easy, logical way to fetch resources asynchronously across the network.
Example
let response = await fetch("./assets/data.json", {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
});
response = await response.json();
console.log(response);