Step 68 Build a pyramid (Javascript)

Tell us what’s happening:

Hello community, Can you please guide me where I might be going wrong? I am not able to pass Step 68 .

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

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount-rowNumber) + character.repeat(rowCount) + " ".repeat(rowCount-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 (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 68

how many spaces do you have between the quotes?

Just one! how many do we need?

we need only one, but here you have more than one

I can confirm I have only one. Don’t know why it shows this way in this formatted code.

you changed the argument here, you may need to reset the lesson

That was it! Thank you so much :slight_smile: Appreciate your help

change the code in line no 1. const character = " " + “#” + “”; use this code in line 1 it works.we have to create space in paramids like # # # # # #. like this

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