Skip to content

Variables tutorial mentions var, but examples use const without explanation #864

@GreCodes

Description

@GreCodes

Issue

In the Variables and Types tutorial, it states that variables are defined using the var keyword. However, the examples immediately use const, which can be confusing for new learners.

> js
> const myNumber = 3;              // a number
> const myString = "Hello, World!" // a string
> const myBoolean = true;          // a boolean
> Expected Behavior

Expected Behavior

It would be helpful to include a short explanation clarifying why const is used instead of var, especially for beginners.

For example:

that const and let are modern JavaScript best practices

that var is older and generally discouraged in new code

or that const is preferred when a variable does not need to be reassigned

This small clarification would improve consistency and reduce confusion for new learners.

Screenshot

Image

Tutorial Link

https://www.learn-js.org/en/Variables_and_Types

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions