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 const to replace var #579

Open
Freed-Wu opened this issue Jan 13, 2025 · 1 comment
Open

use const to replace var #579

Freed-Wu opened this issue Jan 13, 2025 · 1 comment

Comments

@Freed-Wu
Copy link
Contributor

Such as https://github.com/nodejs/node-addon-examples/blob/main/src/1-getting-started/1_hello_world/nan/hello.js

A variable declared with var is accessible in the whole module. Thus, the variable can be accessed before its initialization and outside the block where it is declared.

See MDN web docs for more details.

Unsafe fix: Use 'const' instead.

@mhdawson
Copy link
Member

Happy to accept PRs to make those changes.

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

No branches or pull requests

2 participants