[11-08-2022] JS

PHOTO EMBED

Thu Aug 11 2022 04:24:24 GMT+0000 (Coordinated Universal Time)

Saved by @samee

async function fun(a) {
    var p = new Promise((resolve) => {
        if(a>=0) {
            setTimeout(() => resolve("positive"), 3000);
        }
        else {
            return "negative";
        }
    })
    
    var a = await p
    console.log(a);
}

fun(10);
for(let i=0;i<3;i++) {
        console.log(i);
    }
content_copyCOPY

https://www.programiz.com/javascript/online-compiler/