Update apply method of function in Javascript (#6820)

updated "apply" description before without content.
pull/6823/head
Murilo Silva 3 months ago committed by GitHub
parent 4d915bf979
commit 1f27530527
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 21
      src/data/roadmaps/javascript/content/apply@-BtF34cEzI6J8sZCDRlRE.md

@ -1 +1,20 @@
# apply
# apply
The apply() method of Function instances calls this function with a given this value, and arguments provided as an array (or an array-like object).
```js
const numbers = [5, 6, 2, 3, 7];
const max = Math.max.apply(null, numbers);
console.log(max);
// Expected output: 7
const min = Math.min.apply(null, numbers);
console.log(min);
// Expected output: 2
```
Visit the following resources to learn more:
- [@official@apply() - MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)

Loading…
Cancel
Save