Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Tell us what’s happening:

i have already changed the array’s name, but is still not working.

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 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 18

Then print the rows array to your console.

you need to print the whole array, not just an element

3 Likes

The instructions are not clear at all. I got past this step by changing the value of the rows array, printing that index that was changed, then printing the entire rows array, which was a guess. Those were not the instructions. Here are the instructions word for word:

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

No where does it say you have to print the value you just changed, just to print the whole array.

This was my answer that worked:

rows[2] = 10;
console.log(rows[2]); /* the part I guessed */
console.log(rows);
1 Like

You technically don’t need this part here

the test will pass with just the log statement for the rows array and the update to the third element.

I just tested it in the editor and it passes

Well then I’m not sure why it kept failing for me until I printed rows[2] to the console. I use the freecodecamp chrome browser app to access the curriculum so possibly it’s a bug on there or needed to be refreshed.

solution removed by moderator

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like