when was fetch api for js released code example
Example 1: javascript fetch api get
fetch('http://example.com/movies.json')
.then(response => response.json())
.then(data => console.log(data));
Example 2: How to use fetch api
async function fetchText() {
let response = await fetch('/readme.txt');
let data = await response.text();
console.log(data);
}Code language: JavaScript (javascript)