Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptthis in callbacks vs methodsSingle-choice MCQ

What does this snippet log, and why? It illustrates how `this` binds in extracted methods versus arrow functions.

const obj = { val: 42, regular() { return this?.val; }, arrow: () => this?.val, }; const r = obj.regular; const a = obj.arrow; console.log(r(), a());