Tell us what’s happening:
let rows = [1, 2, 3]; // Initial array
rows[2] = 10; // Update the third element (index 2) to 10
console.log(rows); // Log the entire rows array, now [1, 2, 10]
- You should use bracket notation on the rows array again.
- You should log the rows array.
I do not understand what I’m doing here and it’s not getting through. I would like the correct code for this.
Your code so far
let character = 'Hello';
let count = 8;
let rows = ["Naomi", "Quincy", "CamperChan"];
console.log(rows[0]);
// User Editable Region
let rows = [1, 2, 3]; // Initial array
rows[2] = 10; // Update the third element (index 2) to 10
console.log(rows); // Log the entire rows array, now [1, 2, 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/132.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 21