Learn Introductory JavaScript by Building a Pyramid Generator - Step 19

Tell us what’s happening:

let character = ‘Hello’;
let count = 8;
let rows = [10];
rows[1] = 10;
rows[rows.length] = 10; // Update the last element dynamically
console.log(rows); // Prints the rows array

// Example with another array
let exampleArray = [“Naomi”, “Quincy”, “CamperChan”];
console.log(array[exampleArray.length - 1]);

Your code so far

let character = 'Hello';
let count = 8;
let rows = [10];
rows[1] = 10;
rows[rows.length] = 10; // Update the last element dynamically
console.log(rows); // Prints the rows array

// Example with another array
let exampleArray = ["Naomi", "Quincy", "CamperChan"];
console.log(array[exampleArray.length - 1]);

// User Editable Region



// 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 19

Hi there and welcome to our community!

Did you have a question about this challenge?

Instructions:

Update your rows[2] to dynamically access the last element in the rows array. Refer to the example above to help you.

Example given:

array[array.length - 1]

You subtracted one yourself from your code then added a new line of code that did not subtract the 1.

You will only have one line of code to replace the two I pasted above, and it will look like the example given, plus the original = 10 of course. You are so close. Do not give up. :+1: