Back to Freecodecamp

Step 53

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

latest828 B
Original Source

--description--

A function does not have to return a hard-coded value. It can return the value stored in a variable. Parameters are special variables for a function, so they can also be returned.

Change your padRow function to return the name parameter directly.

--hints--

Your padRow function should return the value of the name parameter.

js
assert.equal(padRow("Naomi"), "Naomi");

--seed--

--seed-contents--

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

--fcc-editable-region--
function padRow(name) {
  return "Hello!";
}
--fcc-editable-region--
const call = padRow();
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);