Back to Freecodecamp

Step 67

curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f34e99571070d56d2f231.md

latest1.3 KB
Original Source

--description--

Your padRow function has two parameters which you defined. Values are provided to those parameters when a function is called.

The values you provide to a function call are referred to as <dfn>arguments</dfn>, and you <dfn>pass</dfn> arguments to a function call. Here's a function call with "Hello" passed as an argument:

js
test("Hello");

Pass i + 1 and count as the arguments to your padRow call. Like parameters, arguments are separated by a comma.

--hints--

You should pass i + 1 to your padRow() call.

js
assert.match(__helpers.removeJSComments(code), /push\(\s*padRow\(\s*i\s*\+\s*1/);

You should have a comma after your i + 1 argument.

js
assert.match(__helpers.removeJSComments(code), /push\(\s*padRow\(\s*i\s*\+\s*1\s*,\s*/);

You should pass count as your second argument.

js
assert.match(__helpers.removeJSComments(code), /push\(\s*padRow\(\s*i\s*\+\s*1\s*,\s*count\s*\)\s*\)/);

--seed--

--seed-contents--

js
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(padRow())
}
--fcc-editable-region--

let result = ""

for (const row of rows) {
  result = result + row + "\n";
}

console.log(result);