Rewrite loops to avoid for in and for of
Closed this issue · 1 comments
MegaArman commented
For in and for of are not necessary.
Object.keys(obj).forEach((key) => obj[key]...));
may look slightly uglier than for in, but it's safer and potentially more efficient as it avoids traversing any properties that aren't the object's own.
For of loops can be substituted by forEach loops, which is more intuitive in the long run because it's more consistent with functional programming (ex: map, reduce, filter, etc.).
MegaArman commented
solved