deno_lint logodeno_lint

All rules/no-var

no-var

Recommended

Enforces the use of block scoped variables over more error prone function scoped

variables. Block scoped variables are defined using const and let keywords.

const and let keywords ensure the variables defined using these keywords are not accessible outside their block scope. On the other hand, variables defined using var keyword are only limited by their function scope.

Invalid:

var foo = "bar";

Valid:

const foo = 1;
let bar = 2;