JS Built-ins
Reflectapplybeginner

Reflect.apply() - Math.max

πŸ“– Usage Example
const result = Reflect.apply(Math.max, null, [1, 5, 3])
console.log(result) // β†’ 5
// Equivalent to: Math.max.apply(null, [1, 5, 3])

Reflect.apply() calls a function with a given this value and arguments array, similar to Function.prototype.apply.

Use Reflect.apply to call Math.max with an array of numbers.

πŸ’‘ Hints (1)
  • β€’ Reflect.apply(fn, thisArg, args) is equivalent to fn.apply(thisArg, args).