fetch headres code example
Example 1: fetch api tutorial
fetch('https://api.github.com/users/manishmshiva', {
method: "GET",
headers: {"Content-type": "application/json;charset=UTF-8"}
})
.then(response => response.json())
.then(json => console.log(json));
.catch(err => console.log(err));
Example 2: work with fetches in js
function yourfunction() {
return fetch(API)
.then(response => response.json())
.then(data => data.content)
}