Back to Freecodecamp

Step 2

curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660ee6e3a242da6bd579de69.md

latest1.3 KB
Original Source

--description--

One of the most important concepts in programming is variables. A <dfn>variable</dfn> points to a specific memory address that stores a value. Variables are given a name which can be used throughout your code to access that value.

Declaring a variable means giving it a name. In JavaScript, this is often done with the let keyword. For example, here is how you would declare a hello variable:

js
let hello;

Variable naming follows specific rules: names can include letters, numbers, dollar signs, and underscores, but cannot contain spaces and must not begin with a number.

Use the let keyword to declare a variable called character.

Note: It is common practice to end statements in JavaScript with a semicolon. ;

--hints--

You should use let in your code.

js
assert.match(__helpers.removeJSComments(code), /let/);

You should use character in your code.

js
assert.match(__helpers.removeJSComments(code), /character/);

You should use let to declare a character variable.

js
assert.match(__helpers.removeJSComments(code), /let\s+character/);

Your declaration should end with a semicolon.

js
assert.match(__helpers.removeJSComments(code), /let\s+character;/);

--seed--

--seed-contents--

js
--fcc-editable-region--

--fcc-editable-region--