Learn Introductory JavaScript by Building a Pyramid Generator - Step 45

Tell us what’s happening:

i don’t get it because i don’t think you’re supposed to change activity in the repeat method.

Your code so far

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


// User Editable Region

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

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 45

The activity variable is only an illustrative example in the challenge description.
You should remove the two lines of code which use that variable.
All you need to do in this step is to apply the repeat method to character, within the existing line of code (i.e. rows.push(character)).

The “Activity” is just an example. remove the "const activity = “character” because you already have that on top of your code, and instead of “activity.repeat(i);” you just have to replace the activity to character, as based on the intructions, we want to repeat the word “i” which prior to what we did, i is = to character.

Hope you solved it.

2 Likes