What does the following code output? console.log(‘a’); setTimeout(() => console.log(‘b’), 0); Promise.resolve().then(() => console.log(‘c’)); console.log(‘d’); JavaScript DeveloperMedium Try Now
What is the output of the following? async function foo() { return 42; } console.log(foo()); JavaScript DeveloperMedium Try Now
What does the following snippet demonstrate? const memoize = fn => { const cache = new Map(); return (…args) => { const key = JSON.stringify(args); if (cache.has(key)) return cache.get(key); const result = fn(…args); cache.set(key, result); return result; }; }; JavaScript DeveloperMedium Try Now
Which approach correctly creates a deep copy of a plain JSON-serializable object in modern JavaScript? JavaScript DeveloperMedium Try Now
What is the difference between shallow copy and deep copy of an object? JavaScript DeveloperMedium Try Now
How would you fix the classic setTimeout-in-loop closure problem to log 0, 1, 2? JavaScript DeveloperMedium Try Now
What does the following code output? for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 0); } JavaScript DeveloperMedium Try Now
What is the difference between call() and apply() when invoking a function? JavaScript DeveloperMedium Try Now
What is the output of the following? const p = new Promise(resolve => resolve(1)); p.then(v => v * 2).then(v => console.log(v)); JavaScript DeveloperMedium Try Now