From 1f275305278c7f29ce919ceda950e63f1132138b Mon Sep 17 00:00:00 2001 From: Murilo Silva <112777858+Zafkiel45@users.noreply.github.com> Date: Tue, 27 Aug 2024 05:06:18 -0300 Subject: [PATCH] Update apply method of function in Javascript (#6820) updated "apply" description before without content. --- .../content/apply@-BtF34cEzI6J8sZCDRlRE.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/data/roadmaps/javascript/content/apply@-BtF34cEzI6J8sZCDRlRE.md b/src/data/roadmaps/javascript/content/apply@-BtF34cEzI6J8sZCDRlRE.md index 97ed10b05..db8715b25 100644 --- a/src/data/roadmaps/javascript/content/apply@-BtF34cEzI6J8sZCDRlRE.md +++ b/src/data/roadmaps/javascript/content/apply@-BtF34cEzI6J8sZCDRlRE.md @@ -1 +1,20 @@ -# apply \ No newline at end of file +# 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)