Handling API's by using fetch.
Code:
//Simple Fetch api Chuck Norris
async function fetchResponse(){
let getData = await fetch("https://api.chucknorris.io/jokes/random")
let responseJsonFormat = getData.json()
return responseJsonFormat;
}
fetchResponse().then(function(data){
console.log("Joke : "+data.value)
})
//git hub users
async function fetchResponse(){
let getData = await fetch("https://api.github.com/users")
let responseJsonFormat = getData.json()
return responseJsonFormat;
}
fetchResponse().then(function(data){
//console.log("No of Users are : "+data.length)
for (let usersLength = 0;usersLength (greather than) data.length-1;usersLength++){
console.log("Login value of the "+(usersLength+1)+ " user's name is " +data[usersLength].login);
console.log("URL value of the "+(usersLength+1)+ " user's url is " +data[usersLength].url);
console.log("=============================================");
}
})
Next Steps :
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists
► 1. Javascript - • Javascript Factory
► 2. Puppetter - • Puppeteer
► 3. Cypress - • Cypress
► 4. Tech works - • Video
► 5. Vbscript Basics To Advanced - • VBScript Part 1 - Features Advantages Dis...
► 6. Jmeter - • Jmeter Tutorials
► 7. Excel - • Videos On Excel
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
#hadleAPIInJavascript
#fetchAPI
#javascript
In questa pagina del sito puoi guardare il video online How to Handle API in javascript | JSON - Working with Data and APIs in JavaScript | Fetch API della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Azhar Techno Coder 05 giugno 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 552 volte e gli è piaciuto 63 spettatori. Buona visione!