What does the HasOwnProperty anti-pattern refer to, and what is the safer alternative? JavaScript ProfessionalHard Try Now
What is the output of the following code? let x = 0; const p = new Promise(resolve => { x = 1; resolve(x); x = 2; }); p.then(v => console.log(v, x)); JavaScript ProfessionalHard Try Now
What is a potential race condition when using Atomics.compareExchange on a SharedArrayBuffer? JavaScript ProfessionalHard Try Now
What distinguishes a SharedArrayBuffer from a regular ArrayBuffer? JavaScript ProfessionalHard Try Now
What does the following code output? const obj = { x: 1, getX() { return this.x; } }; const { getX } = obj; console.log(getX()); JavaScript ProfessionalHard Try Now
What is the purpose of the [[HomeObject]] internal slot on method definitions? JavaScript ProfessionalHard Try Now
What is the output of this code? function test() { var x = 1; const inner = () => x; var x = 2; return inner; } console.log(test()()); JavaScript ProfessionalHard Try Now
What is Tail Call Optimization (TCO) and under what conditions does the ECMAScript specification mandate it? JavaScript ProfessionalHard Try Now
What does the following code output? const arr = [1, 2, 3]; arr[Symbol.iterator] = function* () { yield ‘a’; yield ‘b’; }; console.log([…arr]); JavaScript ProfessionalHard Try Now
Which of the following correctly describes how async iteration (for await…of) works with an async generator? JavaScript ProfessionalHard Try Now
What is the difference between the [[Prototype]] internal slot and the prototype property on a function? JavaScript ProfessionalHard Try Now
What is the output of the following code? const p1 = Promise.resolve(1); const p2 = p1.then(v => { throw new Error(‘oops’); }); const p3 = p2.catch(e => e.message); const p4 = p3.then(v => console.log(v)); // What logs? JavaScript ProfessionalHard Try Now
What is the difference between a module’s live binding and a CommonJS exported value? JavaScript ProfessionalHard Try Now
What does the following code demonstrate about the module system? // a.js import { b } from ‘./b.js’; export const a = 1; // b.js import { a } from ‘./a.js’; export const b = a + 1; JavaScript ProfessionalHard Try Now
What is the output of the following code? class Base { constructor() { this.init(); } init() { this.value = ‘base’; } } class Derived extends Base { init() { this.value = ‘derived’; } } const d = new Derived(); console.log(d.value); JavaScript ProfessionalHard Try Now
How does Serializable Structured Clone differ from JSON.stringify/parse for copying JavaScript values? JavaScript ProfessionalHard Try Now
What does the following Proxy trap code do when obj.foo is accessed? const handler = { get(target, prop, receiver) { return Reflect.get(target, prop, receiver); } }; const obj = new Proxy({ foo: 42 }, handler); JavaScript ProfessionalHard Try Now
What is the purpose of FinalizationRegistry and what guarantees does the spec make about when callbacks fire? JavaScript ProfessionalHard Try Now