const url='textfile.txt';
fetch(url)
.then(response=>{
if(!response.ok){
throw new Error('Network response was not okay😐');
}
return response.text();
})
.then(data=>{
console.log(data);
})
.catch(error=>{
console.log(error);
});