mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-23 12:03:28 -05:00
1.2 KiB
1.2 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 660f4cde8dd305450514a1cb | Step 105 | 1 | step-105 |
--description--
Use a multi-line comment to comment out this loop as well, to prepare for the next approach.
--hints--
Your for loop should be commented out.
const stripped = __helpers.removeJSComments(code);
assert.lengthOf(stripped.match(/for\s*\(/), 1);
Your for loop body should be commented out.
const stripped = __helpers.removeJSComments(code);
assert.notMatch(stripped, /rows\.push/);
--seed--
--seed-contents--
const character = "#";
const count = 8;
const rows = [];
function padRow(rowNumber, rowCount) {
return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}
// TODO: use a different type of loop
/*for (let i = 1; i <= count; i++) {
rows.push(padRow(i, count));
}*/
/*while (rows.length < count) {
rows.push(padRow(rows.length + 1, count));
}*/
--fcc-editable-region--
for (let i = count; i > 0; i--) {
rows.push(padRow(i, count));
}
--fcc-editable-region--
let result = ""
for (const row of rows) {
result = result + "\n" + row;
}
console.log(result);