mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-23 03:53:24 -05:00
1.9 KiB
1.9 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 660f44f10ea40f300b896a5e | Step 84 | 1 | step-84 |
--description--
Now that you have practiced working with if...else if...else statements, you can remove them from your code.
Once you complete that, use let to declare a continueLoop variable and assign it the boolean false. Then use let to declare a done variable and assign it the value 0.
--hints--
You should not have an if statement.
assert.notMatch(__helpers.removeJSComments(code), /if\s*\(/);
You should not have an else if statement.
assert.notMatch(__helpers.removeJSComments(code), /else\s+if\s*\(/);
You should not have an else statement.
assert.notMatch(__helpers.removeJSComments(code), /else\s*\{/);
You should use let to declare a continueLoop variable.
assert.match(__helpers.removeJSComments(code), /let\s+continueLoop/);
Your continueLoop variable should have the value false.
assert.isFalse(continueLoop);
You should use let to declare a done variable.
assert.match(__helpers.removeJSComments(code), /let\s+done/);
Your done variable should have the value 0.
assert.strictEqual(done, 0);
--seed--
--seed-contents--
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--
if ("") {
console.log("Condition is true");
} else if (5 < 10) {
console.log("5 is less than 10");
} else {
console.log("This is the else block");
}
--fcc-editable-region--
let result = ""
for (const row of rows) {
result = result + "\n" + row;
}
console.log(result);