Learn Introductory JavaScript by Building a Pyramid Generator - Step 117

Tell us what’s happening:

  1. You should remove code that was commented out by multi-line comments. this error persist on the code but i didn’t found where multi-line comments in my code

Your code so far

const character = "#";
const count = 8;
const rows = [];
let inverted = true;

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


// User Editable Region

for (let i = 1; i <= count; i++) {
  if (inverted) {
    rows.unshift(padRow(i, count));
  } else {
    rows.push(padRow(i, count));
  }
}

while (rows.length < count) {
  rows.push(padRow(rows.length + 1, count));
}

for (let i = count; i > 0; i--) {
  rows.push(padRow(i, count));
}

// User Editable Region


let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 117

Please “Reset” and try again. You were to remove all commented out code, but instead you seem to have removed just the /* */.

2 Likes

Hi there. I tried the challenge step and it’s also isn’t passing the test on my end. Didn’t know what’s the problem is.

These comments aren’t in the challenge step.

Hi,
The above lines of code were originally commented out, and you were asked to remove them all. As suggested, you should reset the step and try removing the comments.
Good luck!

1 Like

I will reset the step and make sure that all the comments made are properly removed. Appreciate guidance - cleaner code is always a target. It must have happened once!

thank you it works now