curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f4b33e2a3364094ecb540.md
Again, push the result of calling padRow with your i and count variables to your rows array.
Open up the console to see the upside-down pyramid.
Your for loop should call rows.push().
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(/);
You should call padRow() in your .push() call.
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(/);
You should pass i as the first argument to your padRow() call.
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i/);
You should pass count as the second argument to your padRow() call.
assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*count\s*;\s*i\s*>\s*0\s*;\s*i\s*=\s*i\s*-\s*1\s*\)\s*\{\s*rows\.push\(\s*padRow\s*\(\s*i\s*,\s*count\s*\)\s*\)/);
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 = i - 1) {
}
--fcc-editable-region--
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);