// XHR IMPLEMENTATION const tryToPractice =(method,url)=>{ // create a new instance let xhr = new XMLHttpRequest(); // open method initialize the request xhr.open(method,url); // receive a response in json format xhr.responseType='json'; // check whether transaction complete or not xhr.onload=()=>{ if(xhr.status >=400) { console.log("failed!!!"); } else { console.log(xhr.response); } } // request encountered an error xhr.onerror=()=>{ console.log("error!!!!"); } // send a request to server xhr.send(); } let url = "https://jsonplaceholder.typicode.com/users"; tryToPractice("GET",url);