Update article.md

Simplify wording
This commit is contained in:
gleachkr 2022-09-10 12:20:12 -05:00 committed by GitHub
parent 5f2b5a8713
commit f15700d02c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,7 +291,7 @@ set.forEach((value, valueAgain, set) => {
Note the funny thing. The callback function passed in `forEach` has 3 arguments: a `value`, then *the same value* `valueAgain`, and then the target object. Indeed, the same value appears in the arguments twice.
That's for compatibility with `Map` where the callback passed `forEach` has three arguments. Looks a bit strange, for sure. But this convention may help to replace `Map` with `Set` in certain cases with ease, and vice versa.
That's for compatibility with `Map` where the callback passed `forEach` has three arguments. Looks a bit strange, for sure. But this may help to replace `Map` with `Set` in certain cases with ease, and vice versa.
The same methods `Map` has for iterators are also supported: