Async/await:Absolutely! Let's walk through your code line by line with precise explanations, focusing especially on what happens after each awaitand how microtasks are scheduled and executed. ✅ Code Recap: jsCopyEditconsole.log("script start"); async function ...May 23, 2025 · 3 min readcleanasyncjs.hashnode.dev
closures pracitse:Here’s a curated list of 20 closure-related JavaScript questions, progressing from easy to hard, covering fundamental to advanced concepts: Easy (1-7) - Basic Understanding What is a closure? (Definition) Write a function counter() that returns a ...May 23, 2025 · 3 min readcleanclosure.hashnode.dev
Closures:1. First Loop (with differentScope function): for(var i=1;i<=5;i++){ const differentScope = (i)=>{ setTimeout(()=>{ console.log(i) },i*1000); } differentScope(i); } Output: 1 2 3 4 5 (each number printed at 1-...May 23, 2025 · 2 min readcleanclosure.hashnode.dev
practise2:console.log("1"); const promise = new Promise((resolve,reject)=>{ console.log("2"); resolve("3") console.log("4") }) promise.then((res)=>{ console.log("5") console.log(res); console.log("6") }) console.log("7") 🔄 Step-by-...May 22, 2025 · 3 min readcleanasyncjs.hashnode.dev
practise1:const promise1 = new Promise((resolve, reject) => { setTimeout(() => { resolve("promise1 called"); }, 5000); }); const promise2 = new Promise((resolve, reject) => { setTimeout(() => { resolve("promise2 called"); }, 2000); }); async ...May 22, 2025 · 5 min readcleanasyncjs.hashnode.dev