Code Implement JavaScript Async/Await

Implement JavaScript Async/Await

Async keyword before a function return a promise and await keyword used inside async function. Await pause the execution and wait fo promise response result.

 async function getData(){

    const response = await fetch('http://localhost/local/api/fetch_records.php?fetch_all=qefdq3sdf989ujoikjsdf9093');        
    const data = await response.json();
    return data; 

    }

getData().then(function(res){
    console.log(res, 'data promise fetch');
})