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

Use JS best practices #483

Open
dalmia opened this issue Oct 25, 2021 · 0 comments
Open

Use JS best practices #483

dalmia opened this issue Oct 25, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@dalmia
Copy link
Member

dalmia commented Oct 25, 2021

Reference: https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/scope%20%26%20closures/ch3.md

  • Law of Least Exposure: wrap functions being used by just one function within that function
  • Improved Garbage Collection: if some data is not going to be used by later code within a block or function, put that data within its own block so that the Garbage Collector can safely get rid of it. Otherwise, it cannot as that data would be a part of the closure of a function appearing later in the code (read the reference for more details - the example just above 'let' loops)
  • use const wherever possible, then let and then var.
@dalmia dalmia added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant