JS Built-ins
Functioncallbeginner

Function.prototype.call() β€” Math.max with call()

πŸ“– Usage Example
const obj = { val: 5 }
function double() { return this.val * 2 }
double.call(obj)  // β†’ 10

call() is identical to apply() except arguments are passed individually.

Using call() with Math.max

Math.max expects individual arguments. You can invoke it with call() passing null as this.

Challenge: Use Math.max.call(null, 1, 2, 3) and verify the result is 3.

πŸ’‘ Hints (1)
  • β€’ `Math.max` does not use `this`, so pass `null` as `thisArg`.