Back to Freecodecamp

Step 36

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

latest1.1 KB
Original Source

--description--

Your <dfn>iteration</dfn> statement will tell your loop what to do with the iterator after each run.

When you reassign a variable, you can use the variable to reference the previous value before the reassignment. This allows you to do things like add three to an existing number. For example, bees = bees + 3 would increase the value of bees by three.

Use that syntax to replace your "iteration" string with a reassignment statement that increases i by one.

--hints--

You should add one to your i variable.

js
assert.match(__helpers.removeJSComments(code), /i\s*\+\s*1/);

You should assign i + 1 back to your i variable.

js
assert.match(__helpers.removeJSComments(code), /i\s*=\s*i\s*\+\s*1/);

Your for loop should increase i by 1 on each iteration.

js
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*0;\s*i\s*<\s*count;\s*i\s*=\s*i\s*\+\s*1\s*\)/);

--seed--

--seed-contents--

js
const character = "#";
const count = 8;
const rows = [];

--fcc-editable-region--
for (let i = 0; i < count; "iteration") {

}
--fcc-editable-region--