Learn Introductory JavaScript by Building a Pyramid Generator - Step 21

Tell us what’s happening:

step 21 javascript i am not getting the code right

Your code so far

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

// User Editable Region

let rows = [0, "Quincy", "CamperChan"];
rows[Quincy] = 10;
console.log(rows); // prints [0, "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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 21

Hi there,

First of all, delete this line:

because the rows array is already declared for us on line 3.

Now, the instruction asked us to:

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

The rows array currently is:

["Naomi", "Quincy", "CamperChan"]

Now, we have to change the third string "CamperChan" to number 10.

You can take a look at the given example code as a reference:

let array = [1, 2, 3];
array[1] = 25;
console.log(array); // prints [1, 25, 3]

In this code above, we changed the second element of the array named array from number 2 to 25 by:

array[1] = 25;

Now we need to change the third element of the array named rows from the string "CamperChan" to number 10.