Files

943 B

id, title, challengeType, dashedName
id title challengeType dashedName
660f39b444fd6f16d1e49c1f Step 73 1 step-73

--description--

Rather than having to pass i + 1 to your padRow call, you could instead start your loop at 1. This would allow you to create a one-indexed loop.

Update your iterator to start at 1 instead of 0.

--hints--

Your for loop should initialise i at 1.

assert.match(__helpers.removeJSComments(code), /for\s*\(\s*let\s+i\s*=\s*1/);

--seed--

--seed-contents--

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

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

--fcc-editable-region--
for (let i = 0; i < count; i++) {
  rows.push(padRow(i + 1, count));
}
--fcc-editable-region--

let result = ""

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

console.log(result);