1.7 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 660f17d4e9f227d86e834abd | Step 33 | 1 | step-33 |
--description--
To generate a pyramid, you will need to create multiple rows. When you have to perform a task repeatedly until a condition is met, you will use a loop. There are many ways to write a loop.
You are going to start with a basic for loop. for loops use the following syntax:
for (iterator; condition; iteration) {
logic;
}
In the upcoming steps, you'll explore each component of a loop in detail. For now, construct a for loop that includes the terms "iterator", "condition", and "iteration" for the three components. Keep the loop body, the section within the curly braces {}, empty.
--hints--
You should have a for loop.
assert.match(__helpers.removeJSComments(code), /for/);
The first component of your for loop should be the string "iterator".
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*('|")iterator\1/);
The second component of your for loop should be the string "condition".
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*('|")iterator\1\s*;\s*('|")condition\2/);
The third component of your for loop should be the string "iteration".
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*('|")iterator\1\s*;\s*('|")condition\2\s*;\s*('|")iteration\3\s*\)/);
The body of your for loop should be empty.
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*('|")iterator\1\s*;\s*('|")condition\2\s*;\s*('|")iteration\3\s*\)\s*\{\s*\}/);
--seed--
--seed-contents--
const character = "#";
const count = 8;
const rows = [];
--fcc-editable-region--
--fcc-editable-region--