curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f2fbd45b520046cac68e8.md
Remember in an earlier step, you learned about return values. A function can <dfn>return</dfn> a value for your application to consume separately.
In a function, the return keyword is used to specify a return value. For example, this function would return the value given to the first parameter:
function name(parameter) {
return parameter;
}
Use the return keyword to return the value of the character variable, repeated rowNumber times.
You should use the .repeat() method.
assert.lengthOf(__helpers.removeJSComments(code).match(/\.repeat\(/g), 2);
You should use the .repeat() method on your character variable.
assert.lengthOf(__helpers.removeJSComments(code).match(/character\.repeat\(/g), 2);
You should pass rowNumber to your .repeat() call.
assert.match(__helpers.removeJSComments(code), /character\.repeat\(\s*rowNumber\s*\)/);
You should use the return keyword.
assert.match(__helpers.removeJSComments(code), /return/);
You should return the result of your .repeat() call.
assert.equal(padRow(3), "###");
const character = "#";
const count = 8;
const rows = [];
--fcc-editable-region--
function padRow(rowNumber, rowCount) {
}
--fcc-editable-region--
for (let i = 0; i < count; i = i + 1) {
rows.push(character.repeat(i + 1))
}
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);