Back to Freecodecamp

Step 35

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

latest1.3 KB
Original Source

--description--

The <dfn>condition</dfn> of a for loop tells the loop how many times it should iterate. When the condition becomes false, the loop will stop.

In JavaScript, a Boolean value can be either true or false. These are not strings - you will learn more about the difference later on.

For now, you will use the <dfn>less than</dfn> operator (<). This allows you to check if the value on the left is less than the value on the right. For example, count < 3 would evaluate to true if count is 2, and false if count is 4.

Replace your "condition" string with a condition to check if i is less than count.

--hints--

You should use the less than operator.

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

You should use the less than operator to check if i is less than count.

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

Your for loop should use i < count as the condition.

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

--seed--

--seed-contents--

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

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

}
--fcc-editable-region--