fetch api in js

JavaScript
fetch('http://example.com/movies.json')
  .then((response) => {
    return response.json();
  })
  .then((data) => {
    console.log(data);
  });
fetch('http://example.com/movies.json')
  .then(response => response.json())
  .then(data => console.log(data));
// fetch API
var myData = async () => {
    try {
       const raw_response = await fetch("https://jsonplaceholder.typicode.com/users");
       if (!raw_response.ok) { // check for the 404 errors
           throw new Error(raw_response.status);
       }
       const json_data = await raw_response.json();
          console.log(json_data);
       }
       catch (error) { // catch block for network errors
            console.log(error); 
        }
}
fetchUsers();
Source

Also in JavaScript: