curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f535ec33a285b33af3774.md
When inverted is false, you want to build a standard pyramid. Use .push() like you have in previous steps to achieve this.
You should call the .push() method of rows in your else block.
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{\s*rows\.push\(\s*/);
You should pass a padRow() call as the argument for your .push() method.
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{\s*rows\.push\(\s*padRow\(/);
You should pass i as the first argument to your padRow() call.
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{\s*rows\.push\(\s*padRow\(\s*i/);
You should pass count as the second argument to your padRow() call.
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{\s*rows\.push\(\s*padRow\(\s*i\s*,\s*count\s*\)/);
const character = "#";
const count = 8;
const rows = [];
let inverted = true;
function padRow(rowNumber, rowCount) {
return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}
// TODO: use a different type of loop
--fcc-editable-region--
for (let i = 1; i <= count; i++) {
if (inverted) {
rows.unshift(padRow(i, count));
} else {
}
}
--fcc-editable-region--
/*while (rows.length < count) {
rows.push(padRow(rows.length + 1, count));
}*/
/*for (let i = count; i > 0; i--) {
rows.push(padRow(i, count));
}*/
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);