Back to Freecodecamp

Step 6

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

latest1.2 KB
Original Source

--description--

When a variable is declared with the let keyword, you can <dfn>reassign</dfn> (or change the value of) that variable later on. In this example, the value of programmer is changed from "Naomi" to "CamperChan".

js
let programmer = "Naomi";
programmer = "CamperChan";

Note that when reassigning a variable, you do not use the let keyword again.

After your console.log, assign the value "World" to your character variable.

--hints--

You should use character twice in your code.

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

You should use the assignment operator to reassign character.

js
assert.lengthOf(__helpers.removeJSComments(code).match(/character\s*\=/g), 2);

You should use the string "World" in your code.

js
assert.match(__helpers.removeJSComments(code), /("|')World\1/);

Your character variable should have the value "World".

js
assert.equal(character, "World");

Your reassignment should not use let.

js
assert.isBelow(__helpers.removeJSComments(code).match(/let/g).length, 2);

--seed--

--seed-contents--

js
--fcc-editable-region--
let character = 'Hello';
console.log(character);

--fcc-editable-region--