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

let var in loop (question) #3403

Closed
billouboq opened this issue Dec 2, 2016 · 3 comments
Closed

let var in loop (question) #3403

billouboq opened this issue Dec 2, 2016 · 3 comments
Labels
support Questions, discussions, and general support

Comments

@billouboq
Copy link

It's more of a question than an issue.
Would like to know if it is wise to change let variable to var in for loop due to v8 not optimizing it ?

If it is I can make pull requests to change this.

@AdriVanHoudt
Copy link
Contributor

I have heard about this but not sure about the details.

I think @cjihrig will know more about this.

Are you currently having perf problems with it?

@AdriVanHoudt AdriVanHoudt added the support Questions, discussions, and general support label Dec 2, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Dec 2, 2016

There are cases where var is still faster than let. In general, let is still not used in Node core. However, if performance is not suffering, I'd recommend let, especially if it's already written that way. I just saw a notification today in core that this should be fixed in future versions of v8, but that won't be available in Node for a few more months.

EDIT: Reference to aforementioned notification: nodejs/node#8873 (comment)

@billouboq
Copy link
Author

Nice, then no need to change it, thanks.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

3 participants