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 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
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
How does Serializable Structured Clone differ from JSON.stringify/parse for copying JavaScript values? 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
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 output of the following code involving WeakRef? let obj = { name: ‘target’ }; const ref = new WeakRef(obj); obj = null; // GC may or may not have run console.log(ref.deref()?.name); JavaScript ProfessionalHard Try Now
What is the precise difference between Object.getOwnPropertyDescriptor and the in operator for checking property existence? JavaScript ProfessionalHard Try Now
What does the following generator code output? function* gen() { const x = yield 1; yield x + 10; } const g = gen(); console.log(g.next()); // A console.log(g.next(5)); // B JavaScript ProfessionalHard Try Now
What does the following code output and why? function foo() { return { bar: ‘baz’ }; } function foo2() { return { bar: ‘baz’ }; } console.log(foo(), foo2()); JavaScript ProfessionalHard Try Now
Which internal slot does the specification use to track whether a Promise has been resolved, and what prevents resolving a Promise twice? JavaScript ProfessionalHard Try Now
What is the output of the following code? const obj = {}; obj[Symbol.toPrimitive] = (hint) => hint === ‘number’ ? 42 : ‘hello’; console.log(+obj, `${obj}`, obj + ”); JavaScript ProfessionalHard Try Now