Back to Freecodecamp

Step 31

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

latest1.3 KB
Original Source

--description--

Declaring a variable with the let keyword allows it to be reassigned. This means you could change character later to be a completely different value.

For this project, you will not want to change these variable values. So instead, you should use const to declare them. const variables are special.

First, a const variable cannot be reassigned like a let variable. This code would throw an error:

js
const firstName = "Naomi";
firstName = "Jessica";

A const variable also cannot be uninitialized. This code would throw an error:

js
const firstName;

Replace your let keywords with const.

--hints--

You should use const to declare your character variable.

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

You should use const to declare your count variable.

js
assert.match(__helpers.removeJSComments(code), /const\s+count/);

You should use const to declare your rows variable.

js
assert.match(__helpers.removeJSComments(code), /const\s+rows/);

You should not use let in your code.

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

--seed--

--seed-contents--

js
--fcc-editable-region--
let character = "Hello";
let count = 8;
let rows = [];
--fcc-editable-region--