i = count;
for (i = count; i = false; i++) {
console.log(i);
}
please help me with condition being false
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
i = count;
for (i = count; i = false; i++) {
console.log(i);
}
// 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 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 98
for (_declare_iteratior_; _condition_ ; _iteration_) {
}
The instruction asked you to
use the boolean false for your condition and iteration statements
so _condition_ and _iteration_ here should be false.
You may ask why? It doesn’t make sense. The for loop doesn’t do anything if the condition is false.
But for now, just do as the instruction asked. You will make change to the for loop in later steps.
Also, leave the inside of the for loop blank. Don’t log anything.
i = count;
for (i = count; i = false; i++) {
console.log(i);
}
please help make sense
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
i = count;
for (i = count; i = false; i++) {
console.log(i);
}
// 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 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 98
instructions:
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 keyword is missing before i declaration in loop. change the itiration also with false and assignment before for loop and console.log is extra, remove it.
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.