Back to Freecodecamp

Step 9

curriculum/challenges/english/blocks/workshop-logic-checker-app/690a0f7a5c22c15222a6aa5c.md

latest1.2 KB
Original Source

--description--

Now create another if statement that uses isTimmyAGamer as its condition. Inside the body of your if statement, log "Timmy loves to play World of Warcraft." to the console.

Note that you won't see anything logged to the console as the condition of your new if statement is false.

--hints--

You should have two if statements in your code.

js
assert.match(__helpers.removeJSComments(code), /(?:\bif\s*\(.+\)\s*\{.+\}.*)\bif\s*\(.+\)\s*\{.+\}/s);

Your second if statement should use isTimmyAGamer as its condition.

js
assert.match(__helpers.removeJSComments(code), /(?:\bif\s*\(.+\)\s*\{.+\}.*)\bif\s*\(\s*isTimmyAGamer\s*\)\s*\{.+\}/s);

You should log "Timmy loves to play World of Warcraft." to the console within your second if statement.

js
assert.match(__helpers.removeJSComments(code), /(?:\bif\s*\(.+\)\s*\{.+\}.*)\bif\s*\(\s*isTimmyAGamer\s*\)\s*\{\s*console\s*\.\s*log\s*\(\s*('|"|`)Timmy loves to play World of Warcraft.\1\s*\)\s*;?\s*\}/s);

--seed--

--seed-contents--

js
const hasDeveloperJob = true;

if (hasDeveloperJob) {
  console.log("Timmy is employed as a developer.");
}

const isTimmyAGamer = false;

--fcc-editable-region--

--fcc-editable-region--