Hi again, so I tried multiple solutions to this but I seem not to get the thing I am doing wrong. here’s the hint message I get? You should call .repeat() on your " " strings to repeat them rowCount - rowNumber times. the question is what do I change exactly?
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(rowNumber, rowCount) {
return character.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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 68
Yes because its not working,
this was what I wrote initially;
function padRow(rowNumber, rowCount) {
return " “+character.repeat(rowCount-rowNumber)+” ";
}
Ok, but you are not calling .repeat on the " " strings. You changed the argument to the call to .repeat on the string character instead of repeating the " " strings
hmm. from what you said now I am writing it like this but its still wrong;
function padRow(rowNumber, rowCount) {
string = " ";
return string.repeat(rowCount-rowNumber)+character.repeat(rowNumber);
}
is it I have to create a seperate function, because they can’t be two returns in one function