Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js promise all return json array

const requests = ['myapi.com/list','myapi.com/trending']
const jsonArray = await Promise.all(requests.map(url => fetch(url)))
    .then(async (res) => {
        return Promise.all(
            res.map(async (data) => await data.json())
        )
    })
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get all select options 
Javascript :: create slug in javascript 
Javascript :: $ is not defined 
Javascript :: javascript one time event listener 
Javascript :: jest setImmediate is not defined 
Javascript :: length of elements with display none 
Javascript :: javascript date set time 23 59 59 
Javascript :: run javascript from uri 
Javascript :: node express post request json 
Javascript :: jquery in react 
Javascript :: how will it look when there is a container inside a a row bootstrap 
Javascript :: react or vue 
Javascript :: js num to string with leading 0 
Javascript :: fetch request to GraphQL 
Javascript :: ignore logs on android expo 
Javascript :: reaact native expo jsx 
Javascript :: javascript update url without reload 
Javascript :: fs.writefile 
Javascript :: .on change get value 
Javascript :: find the words separated by whitespace in a string javascript 
Javascript :: datatable after render event 
Javascript :: get all rooms socket.io 
Javascript :: javascript current time 
Javascript :: build json object in java 
Javascript :: how to set content length of an mp3 stream in nodejs 
Javascript :: nodejs error _.isNull is not a function 
Javascript :: add disabled js 
Javascript :: javascript find all href with same value 
Javascript :: javascript set file input value to null 
Javascript :: nodejs btoa 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =