This is great article but if you care about performance,
Using this approach is much more appropriate because you only loop once
and not creating new reference for every method you use.
Thanks for this comment 😁, but I totally disagree with you.
Thinking about performance before profiling you code is called "premature optimization" which is a known to be a bad thing in software development, also because without appropriate tests, you don't even know where the "bottlenecks" really are.
Furthermore, 90% of the time you don't have performance problems nor this type of operations leads to performance issues (unless you work with long long long arrays). Also, often performance problems are present due to bad software architecture.
Finally, if you want really performant code maybe you need to consider other solutions than JS 😅
This is great article but if you care about performance,
Using this approach is much more appropriate because you only loop once
and not creating new reference for every method you use.
Unlike this one, although much more readable, but every function creates its own loop.
Correct me if I'm wrong here 😁.
It's just that I prefer performance rather than readability.
Thanks for this comment 😁, but I totally disagree with you.
Thinking about performance before profiling you code is called "premature optimization" which is a known to be a bad thing in software development, also because without appropriate tests, you don't even know where the "bottlenecks" really are.
Furthermore, 90% of the time you don't have performance problems nor this type of operations leads to performance issues (unless you work with long long long arrays). Also, often performance problems are present due to bad software architecture.
Finally, if you want really performant code maybe you need to consider other solutions than JS 😅
Thanks. I'd look into that.