What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-27 23:12:05
promise.all map statement
//Here i have filmresponse.json() which will return promise so i uses promise. //all otherwise it won't be possible to run it let characterResponse = await fetch('http://swapi.co/api/people/2/') let characterResponseJson = await characterResponse.json()... Add solution -
Javascript 2021-09-27 12:55:06
service worker js example
/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.or... Add solution -
Javascript 2021-09-20 16:12:02
promise all in promise all
var p1 = Promise.resolve(3); var p2 = 1337; var p3 = new Promise((resolve, reject) => { setTimeout(resolve, 100, "foo"); }); Promise.all([p1, p2, p3]).then(values => { console.log(values); // [3, 1337, "foo"] }); Add solution -
Javascript 2021-09-15 12:05:02
react map wait axios call
const postIds = ['123', 'dn28e29', 'dn22je3']; const posts = posts.map(post => { return axios .get(`https://example.com/post/${post.id}`) .then(res => res.data) .catch(e => console.error(e)); } Promise.all(posts).then(res => co... Add solution -
Javascript 2021-09-06 13:05:03
how to create multiple folders at once in node js
'use strict'; const { mkdir } = require('fs').promises; (async function main() { try { const parent = '.'; const dirnames = ['pdfs', 'fonts', 'err/or', 'users']; await Promise.all( dirnames.map(dirname => mkdir(`${parent}/${dirn... Add solution