Learn Introductory JavaScript by Building a Pyramid Generator - Step 108

Tell us what’s happening:

declare a SHIFTED variable and use the .shift() method on a number array of [2, 3]
log the SHIFTED variable to the console

Your code so far

const numbers = [2, 3]
const shfited = numbers.shift();
console.log(shifted);

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

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

// TODO: use a different type of loop
/*for (let i = 1; i <= count; i++) {
  rows.push(padRow(i, count));
}*/

/*while (rows.length < count) {
  rows.push(padRow(rows.length + 1, count));
}*/

/*for (let i = count; i > 0; i--) {
  rows.push(padRow(i, count));
}*/


// User Editable Region

const numbers = [2, 3];
const shifted = numbers.shift();
console.log(shifted);


// User Editable Region


let result = ""

for (const row of rows) {
  result = result + row + "\n";
}

console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 108

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

You have changed the given code. Please reset this step and try again.

done still thesame
changed the array element [1,2,3]

please post your updated code

you also had removed the unshifted variable

you will need to reset the step, in this step you only add, do not change or remove existing lines