commit
fab771fc0c
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ When `arr.filter()` is called, it internally creates the new array of results us
|
|||
|
||||
Even more, we can customize that behavior.
|
||||
|
||||
We can add a special static getter `Symbol.species` to the class. If exists, it should return the constructor that JavaScript will use internally to create new entities in `map`, `filter` and so on.
|
||||
We can add a special static getter `Symbol.species` to the class. If it exists, it should return the constructor that JavaScript will use internally to create new entities in `map`, `filter` and so on.
|
||||
|
||||
If we'd like built-in methods like `map` or `filter` to return regular arrays, we can return `Array` in `Symbol.species`, like here:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue