Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Tell us what’s happening:

What is wrong with this code? And do you know at what step the repeat function was introduced?

Your code so far

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


// User Editable Region

function padRow(rowNumber, rowCount) {
  return repeat(rowNumber);

}

// User Editable Region



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

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/130.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 65

Hello @booleanmethod9 !

Good attempt.

We are asked to use the return keyword to return the value of character variable repeated rowNumber times.

The .repeat() was introduced in step 45, I believe. Here is a link to that step.

Wishing you good progress on your coding journey. :slightly_smiling_face:

1 Like

How did you find it that quick?

I went to the lessons and worked backwards. :slightly_smiling_face:

You seem to be an effective and convenient answerer to talk to…
Would you happen to know where the concatenate property was first introduced as well?

1 Like

concatenating strings? step 42

1 Like

Thanks, do you have an idea where row.push was first used?

no, but you can find out by looking at the previous steps

1 Like

Hello @booleanmethod9 !

Part of programming is being able to research and find solutions. As im59138 stated, you could search in the same way that we have done to find the answers to when something was introduced.

In this way, you are building your research and resolve skills, too.

Wishing you good progress on your coding journey! :slightly_smiling_face:

Its one thing to do research its another, if you agree with me, to manually go back on the steps to which lesson treated a particular prompt. It would be noble, but isn’t the whole point of programming finding the most optimal solution?

Well, how do you think someone else is going to find the step you are asking for? I would check each step until I find the right one, and from the phone, which is what I was using then, is quite difficult.

1 Like

Its the first place row.push was introduced if you want to have a go at it friend…

I don’t really want to, thank you for asking! I am sure you will be able to find it

step 36 for rows.push, step 26 for push.

1 Like

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