Skip to content

Spot the De Morgan's Law Bug

Find the Mistake Medium
workbench

Question

This code should print "Invalid" when age is NOT (18 or older AND has license), but the logic is wrong. What is the issue?

Code

                  let age = 16;
let hasLicense = false;
if (!(age >= 18) && !hasLicense) {
  console.log("Invalid");
}
                

Related Resources

Related Lessons

Look up unfamiliar terms

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

View glossary

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

Build real projects

Apply what you learned by building guided projects with starter code and solutions.

View projects

← Back to topic