Skip to content
Skills Library
Programming · Review & audit

const-let

/const-let

Use when reviewing scripts, client components, bundles, or runtime behavior related to Prefer const and let over var. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

Licence
MIT
Last repository change
06.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 06.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when reviewing scripts, client components, bundles, or runtime behavior related to Prefer const and let over var. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

Original author description

Use when reviewing scripts, client components, bundles, or runtime behavior related to Prefer const and let over var. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

How it works

  1. Quick Reference
  2. Check
  3. Fix
  4. Explain
  5. Code Review
Original SKILL.md headings · 35 lines, 223 words
SKILL.md preview
---
name: const-let
description: "Use when reviewing scripts, client components, bundles, or runtime behavior related to Prefer const and let over var. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug."
metadata:
  category: javascript
  priority: high
  difficulty: beginner
  estimatedTime: "10"
  source: frontendchecklist.io
  url: https://frontendchecklist.io/rules/javascript/const-let
---

# Prefer const and let over var

var's function scope and hoisting behavior regularly causes bugs where variables are accessible outside the block they were declared in. const and let enforce block scope and make code intent clearer — const signals that a binding should not be reassigned, which helps readers understand data flow.

## Quick Reference

- Use const for values that are never reassigned
- Use let when reassignment is needed
- Never use var — it has function scope and is hoisted, causing subtle bugs
- const does not mean immutable — objects and arrays declared with const can still be mutated

## Check

Scan this JavaScript file for any use of var and flag every occurrence with line numbers.

## Fix

Replace all var declarations with const or let as appropriate. Use const when the variable is never reassigned, let otherwise.

## Explain

Explain why const and let are preferred over var, covering scope, hoisting, and temporal dead zone.

## Code Review

Review scripts, client components, and browser execution paths related to Prefer const and let over var. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.

---

For full implementation details, code examples, and framework-specific guidance,
see `references/rule.md`.

Rule page: https://frontendchecklist.io/rules/javascript/const-let
Files in this package (2)
  • SKILL.md 2 KB
  • references/rule.md 3 KB

Versions

The database has no other skills named const-let.

Database snapshot: 13.11.2026 · package version cd3d2d5e17bf (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100es-modules
    Use when reviewing scripts, client components, bundles, or runtime behavior related to Use ES modules (import/export). Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
  • 100console-cleanup
    Use when reviewing scripts, client components, bundles, or runtime behavior related to Remove console statements in production. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
  • 100javascript
    Standards and patterns for writing clean, modern JavaScript — const/let (no var), async/await over .then chains, template literals, destructuring, and core fundamentals (closures, promises, scope). Use when the user writes or reviews JavaScript, asks to explain JS concepts…
  • 100rs-macros-const
    Use when writing or reviewing macros, derive/proc macros, build scripts or compile-time computation — macro_rules!, declarative vs procedural macros, derive macros, attribute macros, syn/quote, hygiene, trybuild tests, cargo expand, const fn, const generics, const evaluation,…
  • 100typescript
    Apply these opinionated TypeScript conventions whenever writing or reviewing TypeScript: branded types for domain modeling, discriminated unions for state, `satisfies` over `as`, const objects instead of enums, type-only imports, and the strict tsconfig baseline beyond `strict:…
  • 90Workflow Runtime Debug
    Debug workflow runtime behavior and test frontend features using the nc MCP bridge. Use when debugging workflow execution, testing UI components, inspecting DOM/state, writing frontend tests, or when user mentions nc_eval, nc_run_test, nc bridge, __workflowTest, test harness, or runtime debugging.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.