Learn Introductory JavaScript by Building a Pyramid Generator - Step 97

Tell us what’s happening:

So my problem is idk how i declare rows as a variable for numbers with elements 1 2 and 3

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

/*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

const numbers = rows[];
console.log(numbers)

// 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/121.0.0.0 Safari/537.36 OPR/107.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 97

rows is declared on line 3, you don’t need to declare it again

The instructions for this step don’t mention rows at all, here a reminder on what you need to do:

Start by using const to declare a numbers variable. Assign it an array with the elements 1 , 2 , and 3 . Then log the numbers array.

Instructions:
Start by using const to declare a numbers variable. Assign it an array with the elements 1 , 2 , and 3 . Then log the numbers array.

that is declaration of a variable.

that is you asigned an array name row.

[]

that is an array. you need element 1, 2, and 3 seperated by commas within that [] array.

post your updated code, using three (```) back ticks in a seperate line below and above your code . we can help you by giving hints and suggestions. posting working code solution is not allowed here on the forum.
@Noumenal

no need to declare rows again

push the result of calling padRow with your i and count variables to your rows array.

Array > Push > Calling > Variables
array.push(calling(variable1, variable2)

you can do it :smiley: