Skip to content

use const to replace var #579

Closed
Closed
@Freed-Wu

Description

@Freed-Wu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions