Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Tell us what’s happening:

Hi folks

I have been trying to pass this step for a while, but I can’t seem to figure out what exactly I am failing to do right. I am supposed to update the third element of my rows array to be the number 10. Then print the rows array to my console. Could anyone give me a hint please?
Thanks
L

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[2]);

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Hello @lulskul,

Your code above prints only one element of your array to the console. The step asks for the entire array to be printed.

Does this help?

Keep up the good progress!

Happy Coding! :slightly_smiling_face:

Oh ok, such as

rows[2] = 10;

console.log(rows[0, 1, 2]);

?

1 Like

Please don’t forget to use formatted text to share your code, here’s the guide:
Forum code formatting

1 Like

no, you can’t get multiple elements with that notation
you need to print the whole array, and the whole array is represented with rows

1 Like

The help says to use console.log() with bracket notation
console.log(rows["Naomi", "Quincy", "CamperChan"]);
hovewer I am still getting failed result…

Well, looks like you have to learn more about arrays to pass the task.
Here’s the guide with examples of how it works you may find helpful:

Thanks for pointing me out towards the right direction

1 Like

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