Learn Introductory JavaScript by Building a Pyramid Generator - Step 22

Tell us what’s happening:

i guess i dont really understand why i am not able to move on to the next problem please help

Your code so far

let character = 'Hello';
let count = 8;
let rows = ["Naomi", "Quincy", "CamperChan"];
console.log(rows[0]);

// User Editable Region

rows[2] = 10;
console.log[rows.length - 1]

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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 22

Hi there,

On this step, you only need to make change to this line of code:

The instruction said:

Update your rows[2] to dynamically access the last element in the rows array.

rows[2] is the third elements of the rows array, its index is: 2

Now, we need to change it (rows[2]) to the last element of the rows array.

How can we do that?

We do it by change the index 2 to the index of the last element.

What’s the index of the last element?

You can look at the given example to have the answer:

array[array.length - 1]

Reset your code and try again. Happy coding!