Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Tell us what’s happening:

I don’t understand what I have to do differently. Please help!

Your code so far

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

// User Editable Region

let array = ["Naomi", "Quincy", "CamperChan"];
array[2] = 10;
console.log(rows[0, 1, 2]); // prints [Naomi, Quincy, 10]

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Hi there! To log the whole rows array you don’t have to specify the indexes

So just type ‘console.log(rows)’? Because I have tried that and it says I need to use brackets. I appreciate your help very much!

remove these two lines, you need to update the rows array

Update the third element of your rows array to be the number 10 . Then print the rows array to your console.

Hello, Ilenia. Thank you for your help but I’m still having a lot of trouble getting passed this step. Could you please specify? I’ve updated the rows array so that the third element is 10 but it’s still completely incorrect. It states that I’m not assigning anything and that I need to log the array which I believe I am doing. Thank you again vfor your help.

show me how you updated the rows array please

let array = [0, 1, 10];

array[2] = 10;

console.log(rows[0, 1, 2]); // prints [Naomi, Quincy, 10]

you are not changing the rows array, see that you are not writing rows at all here? you need to mention the array you are changing

This is very confusing for me because the example it provided doesn’t show it like that. Could you please provide an example of what it should look like?

the example shows array[2] = 10 because it is changing the array array, you need to change the rows array.

I can show you other examples, like

const myArr = [0, 0, 0, 0, 0, 0];
myArr[1] = 1;

this changes the second element of myArr to 1

1 Like

you added extra code to your challange, reset your challenge and just
Update the third element of your rows array to be the number 10 . Then print the rows array to your console.

1 Like

Wow thank you that helps a lot. I’m still not passing though. Now it’s asking for the use of brackets but I am using brackets? Perhaps not in the right spot.

rows[2] = 10;

console.log(rows[0, 1, 2]); // prints [Naomi, Quincy, 10]

now, here, you want to print all of the rows array, for which you got advice from @Ray13, so try to follow that advice for this line

you also need to remove this line

1 Like

Thank you so much! It finally passed