Back to Freecodecamp

Step 7

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

latest950 B
Original Source

--description--

Now log your character variable to the console again. You should see the string "Hello", then the string "World", in the console.

--hints--

You should use console.log a second time.

js
assert.lengthOf(__helpers.removeJSComments(code).match(/console\.log/g), 2);

You should log character to the console a second time.

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

Your new console.log() should come after your reassignment.

js
const lines = __helpers.removeJSComments(code).split(/\n+/)
const reassign = lines.findIndex(l => l.match(/character\s+=\s+("|')World\1/));
const secondLog = lines.findLastIndex(l => l.match(/console\.log/));
assert.isBelow(reassign, secondLog);

--seed--

--seed-contents--

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

--fcc-editable-region--