100+ JavaScript

Loop In JS Function localStorage Drag Drop Object get set

Asynchronous JS

Callback Promises

Web API

Web API Intro Cookie Fetch API

JS PDF

Basic Pdf

Toast.js

Basic Toastr

Fetching Data From an API

The Fetch API is a modern way to make HTTP requests in JavaScript. It allows you to request resources over the network, such as data from a server, and handle the responses asynchornously using promises.

Basic Example: Fetching Data form an API.
                            
    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);
    });