Learn Introductory JavaScript by Building a Pyramid Generator - Step 77

Tell us what’s happening:

I’m not sure why this code does not pass. The syntax is what it is asking us to do?
if (true) {
“Condition is true”
};

Your code so far

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

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

// TODO: use a different type of loop
/*for (let i = 1; i <= count; i++) {
  rows.push(padRow(i, count));
}*/


// User Editable Region

  if (true) {
   "Condition is true"
};

// User Editable Region


let result = ""

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

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 77

Which step are you on? You linked to step 77 and the instructions are:

Use /* and */ to turn your current for loop, including the body, into a multi-line comment.

Which you seem to have done. You seem to be working on a different Step.

You’re on step 78.

You’re nearly there. Try and work out what the instructions on step 78 mean by “print”. Putting “Condition is true” on its own won’t work to return the value.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.