Back to Freecodecamp

Step 54

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

latest1.2 KB
Original Source

--description--

If you open your console again, you'll see that your padRow function is returning undefined, even though you defined a return value! This is because parameters need to be given a value when you call the function.

When you pass a value to a function call, that value is referred to as an <dfn>argument</dfn>. Here is an example of calling a demo function and passing "Naomi" as the argument for the name parameter.

js
function demo(name) {
  return name;
}
demo("Naomi");

Pass your own name as the argument for the name parameter in your padRow call. Remember that your name is a string, so you'll need to use quotes.

--hints--

You should pass a string to your padRow() call.

js
assert.match(__helpers.removeJSComments(code), /padRow\(\s*("|').+\1\s*\)/);

--seed--

--seed-contents--

js
const character = "#";
const count = 8;
const rows = [];

function padRow(name) {
  return name;
}
--fcc-editable-region--
const call = padRow();
--fcc-editable-region--
console.log(call);


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);