curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f34626216270c682e2f7b.md
A <dfn>function call</dfn> allows you to actually use a function. You may not have been aware of it, but the methods like .push() that you have been using have been function calls.
A function is called by referencing the function's name, and adding (). Here's how to call a test function:
test();
Replace the character.repeat(i + 1) in your .push() call with a function call for your padRow function. Do not add any arguments to it yet.
You should not use i + 1 in your push call.
assert.notMatch(__helpers.removeJSComments(code), /repeat\(\s*i\s*\+\s*1\s*\)/);
You should not use character.repeat in your .push() call.
assert.notMatch(__helpers.removeJSComments(code), /push\(\s*character/);
You should call padRow in your .push() call.
assert.match(__helpers.removeJSComments(code), /push\(\s*?padRow\((.+?)?\)\)/);
You should not have arguments in your padRow call.
assert.match(__helpers.removeJSComments(code), /push\(\s*?padRow\(\s*?\)/);
const character = "#";
const count = 8;
const rows = [];
function padRow(rowNumber, rowCount) {
return character.repeat(rowNumber);
}
--fcc-editable-region--
for (let i = 0; i < count; i = i + 1) {
rows.push(character.repeat(i + 1))
}
--fcc-editable-region--
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);