Learn Introductory JavaScript by Building a Pyramid Generator - Step 39

Tell us what’s happening:

const character = “#”;
const count = 8;
const rows = ;

for (let i = 0; i < count; i = i + 1) {
rows.push(i);
}

let result = “”; // Declare a result variable as an empty string

for (let i = 0; i < count; i = i + 1) {
result += i; // Append the current value of i to the result string
}

console.log(result);

it says that result variable should be empty what can I do ?

Your code so far



// User Editable Region

const character = "#";
const count = 8;
const rows = [];

for (let i = 0; i < count; i = i + 1) {
  rows.push(i);
}

let result = ""; // Declare a result variable as an empty string

for (let i = 0; i < count; i = i + 1) {
  result += i; // Append the current value of i to the result string
}

console.log(result);

// 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/120.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 39

I think you should reset this step.

After that, add the new result variable in the editor. Don’t modify any existing code.