Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count down to zero #139

Open
ehpc opened this issue Sep 25, 2014 · 1 comment
Open

Count down to zero #139

ehpc opened this issue Sep 25, 2014 · 1 comment

Comments

@ehpc
Copy link

ehpc commented Sep 25, 2014

It is kind of unclear why counting down and while (https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/for-loops.html) are preferred patterns, because modern browsers preoptimize these constructs. Maybe it will be a good idea to include some jsperf test, for example http://jsperf.com/for-vs-foreach/219.

@gianlucascoccia
Copy link

I'd like to add that semantically the preferred pattern is not the same as the others, sometimes the order in which you visit the array matters. Maybe add a comment to explain it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants