Learn Introductory JavaScript by Building a Pyramid Generator - Step 90

Tell us what’s happening:

Hi there

Can someone please help with this question. I put:

padRow.push(done, count);

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));
}*/

let continueLoop = false;
let done = 0;

while (continueLoop) {
  done++;

// User Editable Region



// User Editable Region

  if (done === count) {
    padRow.push(done, count);
  } 
}

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/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 90

Your code is pushing done and count to padRow.

This is not correct. It should push the padRow function with count and done as parameters to the rows array. That means the array name should come first then the function call should be in the parenthesis.

I tried this and doesn’t work.
rows(padRow.push(done, count));

that’s not correct syntax, rows is an array, you can’t call it as a function. But you can call push on rows. Then between the parenthesis of push you write the padRow function with the required arguments

I don’t get it, sorry

here you have five things to understand, you have rows which is an array, you have .push() which is a method that allows adding new items at the end of an array, you have padRow() which is the function you were writing in the previous steps, and done and count which are two numbers

You need to add the output of padRow called with count and done at the end of the rows array using .push()

does this all make sense to you?

not really, I don’t understand it

what of the five items give you trouble?

everything, what is the answer please, I will come back to it some other time

Giving the answer is not allowed on the forum, if you have no idea what any of the 5 items is, I would suggest you start again at the begigging of the project. If you have no idea what you are doing you are not learning

ok I will go back then