What is the output of the following? “`js let resolve; const p = new Promise(r => { resolve = r; }); p.then(v => console.log(‘resolved:’, v)); resolve(42); console.log(‘sync done’); “` JavaScript ProfessionalMedium Try Now
What is the difference between `Array.prototype.copyWithin()` and `Array.prototype.fill()`? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js function foo(a, b = a * 2, c = a + b) { return [a, b, c]; } console.log(foo(3)); “` JavaScript ProfessionalMedium Try Now
What is the `Temporal` proposal in JavaScript and what problem does it solve? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const obj = {}; obj.a = 1; Object.defineProperty(obj, ‘b’, {value: 2, enumerable: false}); const copy = {…obj}; console.log(copy); “` JavaScript ProfessionalMedium Try Now
What is `WeakSet` in JavaScript and how does it differ from `Set`? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const promises = [1,2,3].map(n => new Promise(resolve => setTimeout(() => resolve(n * 2), n * 100)) ); Promise.all(promises).then(results => console.log(results)); “` JavaScript ProfessionalMedium Try Now
What is the purpose of `Object.getOwnPropertyDescriptor()` and when would you use it? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js function tag(strings, …values) { return strings.raw[0] + values[0]; } console.log(tag`HellonWorld ${42}`); “` JavaScript ProfessionalMedium Try Now
What is the difference between `arguments` object and rest parameters `…args`? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const target = {}; const handler = { get(t, key) { return key in t ? t[key] : `Property ${key} not found`; } }; const proxy = new Proxy(target, handler); target.name = ‘Alice’; console.log(proxy.name); console.log(proxy.age); “` JavaScript ProfessionalMedium Try Now
What is tree shaking in JavaScript module bundlers and what syntax enables it? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const obj = { data: [1, 2, 3], double() { return this.data.map(function(n) { return n * this.multiplier; }); }, multiplier: 2 }; console.log(obj.double()); “` JavaScript ProfessionalMedium Try Now
What is an Immediately Invoked Function Expression (IIFE) and what problem did it solve before ES modules? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const a = {x: 1}; const b = {x: 1}; const m = new Map(); m.set(a, ‘first’); m.set(b, ‘second’); console.log(m.size); console.log(m.get({x:1})); “` JavaScript ProfessionalMedium Try Now
What is the difference between `Map.prototype.forEach()` and iterating with `for…of` on a Map? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const gen = function*() { const x = yield 1; const y = yield x + 2; return y; }; const g = gen(); console.log(g.next().value); console.log(g.next(10).value); console.log(g.next(20).value); “` JavaScript ProfessionalMedium Try Now
What does `Reflect.apply()` do and why prefer it over `Function.prototype.apply()`? JavaScript ProfessionalMedium Try Now