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

What does the following log? It shows how `Array.prototype.map` handles `this` for the callback when a `thisArg` is supplied.

const ctx = { factor: 3 }; const out = [1, 2].map(function (x) { return x * this.factor; }, ctx); console.log(out);