Learn Introductory JavaScript by Building a Pyramid Generator - Step 94

Tell us what’s happening:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 94

Your code so far

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));
}*/


// User Editable Region

for (let i = count; i !== fals; i -= 1) {
  
}

// User Editable Region


let result = ""

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

console.log(result);

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 94

Hi there!
For this step you need to use the Boolean false for the for loop condition and iteration. Don’t assign any value yet.

how i don’t understand

Instead of the above assignment, you need to add just the Boolean value false.

i add it’s say
// running tests Your

for

loop should use

false

as the iteration. // tests completed // console output

Show your updated code here

Add three back ticks (```) in a separate line below and above your code, while you posting it here.
@andiethio

Your code is currently is:

The task to do:

Start by creating a new for loop. Declare your iterator i and assign it the value of count, then use the boolean false for your condition and iteration statements.

Let’s break it down into simpler steps.

Step 1:

Start by creating a new for loop.

Your code:

for () {
}

Status: Done!


Step 2:

Declare your iterator i and assign it the value of count

Your code:

let i = count

Status: Done!


Step 3:

use the boolean false for your condition

Your condition is currently is:

i !== fals

The condition should be:

false

Status: Unfinished.


Step 4:

use the boolean false for iteration statements

Your iteration statements currently is:

i -= 1

The iteration statement should be:

false

Status: Unfinished.

2 Likes

delete this, add only false (do not forget the e!) in its place

1 Like

Your

for

loop should use

false

as the iteration i don’t understand

Yes, it doesn’t make sense to use false as the iteration.
Normally, it should be something like i++, i-- or i +=1, i-=1.
But for this challenge purpose, just use false as the iteration like the instruction asked.

heres the solution for your problem

solution removed by mod

its double false because you need a false return for the condition (first false) and the iteration (second false) hope this helps! ^-^

hey @Ryan225-bit

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

1 Like

Thanks, this post help me a lot!

1 Like
for (initialization;  condition;  afterthought) {
       // code block to be executed
}

Your for loop should use false as the condition
Your for loop should use false as the iteration

You can use this article Loops and iteration - JavaScript | MDN , i’ve been stuck for this step for 20 mins :face_with_spiral_eyes:

1 Like