promise

Run Settings
LanguageJavaScript
Language Version
Run Command
const operation1 = function(tes) { return new Promise((resolve, reject) => { if (tes === 1) { resolve(true) } else { reject(false) } }) } const operation2 = function(tes) { return new Promise((resolve, reject) => { if (tes === 1) { resolve(false) } else { reject(true) } }) } // operation1(1).then((data) => console.log(data)).catch((err) => console.log(err)) async function executed() { const batch = await Promise.all([operation1(1), operation2(1)]) console.log(batch) } executed()
Editor Settings
Theme
Key bindings
Full width
Lines