Update apply method of function in Javascript (#6820)
updated "apply" description before without content.pull/6823/head
parent
4d915bf979
commit
1f27530527
1 changed files with 20 additions and 1 deletions
@ -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…
Reference in new issue