Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

Tell us what’s happening:

i have no idea what should i do with the intructions because my tries were incorrect.
The instuctions: Update your blank space strings to be repeated rowCount - rowNumber times.

Your code so far

const character = "#";
const count = 8;
const rows = [];
" ".repeat(rowCount - rowNumber);

// User Editable Region

function padRow(rowNumber, rowCount) {
  
  return " " + character.repeat(rowNumber) + " ";
  

// User Editable Region

  
}

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

let result = ""

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

console.log(result);

Your browser information:

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 69

You are repeating the space strings rowNumber times:

.repeat(rowNumber)

Read about the repeat() function here: https://www.w3schools.com/jsref/jsref_repeat.asp

Syntax
string.repeat(count)
Parameters
count	Required.
The number of copies.

Instead of just the variable rowNumber you need to pass rowCount - rowNumber to the repeat() function.

1 Like