.fetch js code example
Example 1: javascript fetch api
fetch('http://example.com/movies.json')
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
});
Example 2: fetch api javascript
fetch('http://example.com/movies.json')
.then((response) => {
return response.json();
})
.then((myJson) => {
console.log(myJson);
});
Example 3: fetch api javascript
fetch('https://apiYouWantToFetch.com/players')
.then(response => response.json())
.then(players => console.log(players))
Example 4: fetch
fetch('http://example.com/movies.json')
.then(response => response.json())
.then(data => console.log(data));