curriculum/challenges/english/blocks/workshop-logic-checker-app/690a3ce03013be44d116136e.md
A conditional statement can have an else clause, which runs code when the if condition is falsy. Here's an example of an if...else statement:
if (condition) {
console.log("condition is truthy");
} else {
console.log("condition is falsy");
}
Add an else clause to the existing if statement. Inside the body of your else clause, log "Timmy is not old enough to drive." to the console.
Your third if statement should have an else clause.
assert.match(__helpers.removeJSComments(code), /const\s+timmyAge\s*\=\s*.+\bif\s*\(\s*timmyAge\s*>=\s*16\s*\)\s*\{\s*console\s*\.\s*log\s*\(\s*('|"|`)Timmy is old enough to drive.\1\s*\)\s*;?\s*\}\s+else\s+{/s);
You should log "Timmy is not old enough to drive." to the console within the body of your else clause.
assert.match(__helpers.removeJSComments(code), /const\s+timmyAge\s*\=\s*.+\bif\s*\(\s*timmyAge\s*>=\s*16\s*\)\s*\{\s*console\s*\.\s*log\s*\(\s*('|"|`)Timmy is old enough to drive.\1\s*\)\s*;?\s*\}\s+else\s+{\s*console\s*\.\s*log\s*\(\s*('|"|`)Timmy is not old enough to drive.\1\s*\)\s*;?\s*\}/s);
const hasDeveloperJob = true;
if (hasDeveloperJob) {
console.log("Timmy is employed as a developer.");
}
const isTimmyAGamer = false;
if (isTimmyAGamer) {
console.log("Timmy loves to play World of Warcraft.");
}
const timmyAge = 18;
if (timmyAge >= 16) {
console.log("Timmy is old enough to drive.");
--fcc-editable-region--
}
--fcc-editable-region--