Arrow functions don't have a `prototype` property (#25198)

pull/34459/head
Edy Ionescu 2018-11-26 18:03:29 +02:00 committed by Aditya
parent 5ec14e5928
commit d46dc349f1
1 changed files with 7 additions and 1 deletions

View File

@ -85,9 +85,15 @@ An arrow function does not have its own `arguments` object. For example, if you
const myFunc = (...n) => {
console.log('The first argument is', n[0]);
}
myFunc(10,20,30,40,40); // output: The first argument is 10
```
Because of this, an arrow function cannot be used as a constructor, hence there's no need for a `prototype` property.
```javascript
(() => {}).hasOwnProperty('prototype'); // false
```
#### Further Reading
<a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions' target='_blank' rel='nofollow'>MDN link</a>