From 4959c4c1119afbc042be23fb871effc94876a31f Mon Sep 17 00:00:00 2001 From: Vishesh Date: Thu, 8 Nov 2018 20:32:09 -0500 Subject: [PATCH] Fat Arrows do not work well with arguments example (#20595) * Fat Arrows do not work well with arguments example * added clarity --- guide/english/javascript/arrow-functions/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guide/english/javascript/arrow-functions/index.md b/guide/english/javascript/arrow-functions/index.md index e8c5cf0ee2..800bd86c25 100644 --- a/guide/english/javascript/arrow-functions/index.md +++ b/guide/english/javascript/arrow-functions/index.md @@ -80,7 +80,14 @@ function Person(){ var p = new Person(); ``` +An arrow function does not have its own `arguments` object. For example, if you do not know the number of arguments passed to a function, instead of using `arguments` you can use the `rest` operator: +```javascript +const myFunc = (...n) => { + console.log('The first argument is', n[0]); +} +myFunc(10,20,30,40,40); // output: The first argument is 10 +``` #### Further Reading MDN link