LESSON 02 OF 50

Declare a constant

Store a name that should not be reassigned with const.

Official sourceECMAScript — let and const declarationsReviewed: 2026-08-26
STEP 1 · LEARN

How it works

A const declaration creates a lexical binding that must be initialized in the same declaration. The name cannot be reassigned later.

Correct example
const studio = 'MP Web Studio';
console.log(studio);

The value is stored under studio and then read by console.log.

Common mistake
const studio;
studio = 'MP Web Studio';

const requires initialization in its declaration; splitting the steps causes a syntax error.

STEP 2 · APPLY

Your exercise

Declare const studio with “MP Web Studio” and print the variable.

STEP 3 · RUN

Write and run the code

script.jsJAVASCRIPT
Isolated consoleisolated
Preparing the runtime…
Run the code to see the result.
The draft stays only in this browser.Isolated QuickJS · no DOM, session or network
STEP 4 · CHECK

What needs to pass

0%not checked
  • studio is declared with const.
  • The code runs without an error.
  • The output contains “MP Web Studio”.
Explain the solution logic

The declaration binds the name to the value, and the output confirms the binding is read rather than printing separate text.