Skip to content

Commit a072018

Browse files
committed
fixes
1 parent c738e37 commit a072018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/05-data-types/05-array-methods/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ alert(soldiers[1].age); // 23
685685

686686
If in the example above we used `users.filter(army.canJoin)`, then `army.canJoin` would be called as a standalone function, with `this=undefined`, thus leading to an instant error.
687687

688-
That said, a call `users.filter(user => army.canJoin(user))` also guarantees the correct `this`, and it's more obvious what's going on, so in practice the arrow function is used most of time, instead of `thisArg`.
688+
A call to `users.filter(army.canJoin, army)` can be replaced with `users.filter(user => army.canJoin(user))`, that does the same. The former is used more often, as it's a bit easier to understand for most people.
689689

690690
## Summary
691691

0 commit comments

Comments
 (0)