curriculum/challenges/english/blocks/learn-introductory-javascript-by-building-a-pyramid-generator/660f415b76859a2736771607.md
Your pyramid has disappeared again. That's okay - that is to be expected.
Before you create your new loop, you need to learn about if statements. An <dfn>if statement</dfn> allows you to run a block of code only when a condition is met. They use the following syntax:
if (condition) {
logic
}
Create an if statement with the boolean true as the condition. In the body, print the string "Condition is true".
You should create an if statement.
assert.match(__helpers.removeJSComments(code), /if/);
Your if statement should have true as the condition.
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*true\s*\)/);
Your if body should log "Condition is true".
assert.match(__helpers.removeJSComments(code), /if\s*\(\s*true\s*\)\s*\{\s*console\.log\(\s*("|')Condition is true\1\s*\);?/);
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));
}*/
--fcc-editable-region--
--fcc-editable-region--
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
console.log(result);