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 tree shaking in JavaScript module bundlers and what syntax enables it? 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 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 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 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 is the output of the following? “`js const p = new Promise(resolve => { console.log(‘A’); resolve(‘B’); console.log(‘C’); }); p.then(v => console.log(v)); console.log(‘D’); “` JavaScript ProfessionalMedium Try Now
What does `Reflect.apply()` do and why prefer it over `Function.prototype.apply()`? JavaScript ProfessionalMedium Try Now
What is the purpose of `Object.seal()` compared to `Object.freeze()`? JavaScript ProfessionalMedium Try Now
What is function composition in a practical JavaScript example? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js class Counter { #count = 0; increment() { this.#count++; } get value() { return this.#count; } } const c = new Counter(); c.increment(); c.increment(); console.log(c.value); console.log(c.#count); “` JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const arr = [1, 2, 3]; arr[10] = 99; console.log(arr.length); console.log(arr[5]); “` JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js function outer() { var x = 1; function inner() { var x = 2; console.log(x); } inner(); console.log(x); } outer(); “` JavaScript ProfessionalMedium Try Now
What is debouncing and how does it differ from throttling in JavaScript? JavaScript ProfessionalMedium Try Now
What is the difference between named exports and default exports in ES modules? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const nums = [1, 2, 3, 4, 5]; const result = nums.reduce((acc, n) => n % 2 === 0 ? […acc, n * 2] : acc, []); console.log(result); “` JavaScript ProfessionalMedium Try Now