fetch in javascripts code example
Example 1: fetch api javascript
fetch('http://example.com/movies.json')
.then((response) => {
return response.json();
})
.then((myJson) => {
console.log(myJson);
});
Example 2: fetch
fetch('http://example.com/movies.json')
.then(response => response.json())
.then(data => console.log(data));