Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

return fetch javascript

async function yourFunction() { //Most compact way to return a fetch
    const response = await fetch('some-url', {}); 
    const json = await response.json();
    return json; //do here wathever with your json if you want to return
}				//a specific part of it.

yourFunction().then(resp => {
    console.log(resp); //Here you get the function response and print it
});
 
PREVIOUS NEXT
Tagged: #return #fetch #javascript
ADD COMMENT
Topic
Name
4+4 =