What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-12 01:16:08
async function in variable
function resolveAfter2Seconds(x) { return new Promise(resolve => { setTimeout(() => { resolve(x); }, 2000); }); }; (async function(x) { // fonction asynchrone immédiatement appelée var a = resolveAfter2Seconds(20);... Add solution -
Javascript 2021-09-29 04:48:03
how to clear state in react hooks
const { useState } = React; function signupUser() { return new Promise(resolve => { setTimeout(resolve, 1000); }); } const initialState = { username: "", email: "", password: "", passwordConfirmation: &qu... 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