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 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 debouncing and how does it differ from throttling in JavaScript? 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 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
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 async function foo() { try { await Promise.reject(new Error(‘oops’)); } catch(e) { console.log(e.message); } } foo(); “` JavaScript ProfessionalMedium Try Now
What is prototype-based inheritance and how does it differ from classical class-based inheritance? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js const fn = (function() { let count = 0; return { increment: () => ++count, getCount: () => count }; })(); fn.increment(); fn.increment(); console.log(fn.getCount()); “` JavaScript ProfessionalMedium Try Now
What is the difference between `Promise.any()` and `Promise.race()`? JavaScript ProfessionalMedium Try Now
What is the output of the following code? “`js const obj = { a: 1, b: 2 }; const { a, …rest } = obj; console.log(rest); “` JavaScript ProfessionalMedium Try Now
What is the difference between `shallow copy` and `deep copy` and which methods in JavaScript create each? JavaScript ProfessionalMedium Try Now
What is the output of the following? “`js console.log([] + []); console.log({} + []); console.log([] + {}); “` JavaScript ProfessionalMedium Try Now