What do you want to save?
Add Code snippet
New code examples
-
Other 2021-09-12 11:59:01
Run a second function only after the first function is completely finished
function run2functions() { firstFunc(secondFunc); } function firstFunc(cb) { setTimeout(() => { },1000); cb(); console.log("first one"); } function secondFunc() { setTimeout(() => { console.log("secon... Add solution -
Javascript 2021-09-10 04:17:03
nodejs promise async
// server.js function square(x) { return new Promise(resolve => { setTimeout(() => { resolve(Math.pow(x, 2)); }, 2000); }); } async function layer(x) { const value =... Add solution -
Javascript 2021-08-31 11:56:01
async await javascript stack overflow
function makePromise(x) { return new Promise(resolve => { setTimeout(() => { resolve(x); }, 1000); }); } async function asyncFunc() { var x = await makePromise(1); // the function is paused here until the prom... Add solution