• Home
  • Python
    • Introduction to Python
    • Python Developer
    • Expert Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
    • Expert JavaScript Developer
  • React.js
    • Introduction to React
    • React Developer
    • Expert React Developer
  • Linux
    • CyberSecurity - Introduction to Linux
    • CyberSecurity - Linux Administrator
    • CyberSecurity - Expert Linux Administrator
  • Active Directory
    • CyberSecurity - Introduction to Active Directory
    • CyberSecurity - Active Directory Administrator
    • CyberSecurity - Expert Active Directory Administrator
  • Interactive Training
  • Pricing
  • Brainstorm
STEMTrainingGrounds
  • Courses
    • Home
    • Python
      • Introduction to Python
      • Python Developer
      • Expert Python Developer
    • JavaScript
      • Introduction to JavaScript
      • JavaScript Developer
      • Expert JavaScript Developer
    • React
      • Introduction to React
      • React Developer
      • Expert React Developer
    • Linux
      • CyberSecurity - Introduction to Linux
      • CyberSecurity - Linux Administrator
      • CyberSecurity - Expert Linux Administrator
    • Active Directory
      • CyberSecurity - Introduction to Active Directory
      • CyberSecurity - Active Directory Administrator
      • CyberSecurity - Expert Active Directory Administrator
  • Interactive Training
  • Pricing
  • Brainstorm

Quick Links

  • About Us
  • Pricing
  • Brainstorm

Courses

  • Python
    • Introduction to Python
    • Python Developer
    • Expert Python Developer
  • JavaScript
    • Introduction to JavaScript
    • JavaScript Developer
    • Expert JavaScript Developer
  • React
    • Introduction to React
    • React Developer
    • Expert React Developer
    • Professional Master React Developer
  • Linux
    • CyberSecurity - Introduction to Linux
    • CyberSecurity - Linux Administrator
    • CyberSecurity - Expert Linux Administrator
  • Active Directory
    • CyberSecurity - Introduction to Active Directory
    • CyberSecurity - Active Directory Administrator
    • CyberSecurity - Expert Active Directory Administrator

Newsletter

Subscribe to our monthly newsletter, for a quick update on Python, JavaScript, React news

© 2024 - 2026 STEMTrainingGrounds. All Rights Reserved.

Lesson 5

Lesson 5 of 16

Boolean Operators

Lesson Progress: 0%

Code Example

raining = true;
warm = false;
console.log(raining && warm); // false

// Do you have a ticket AND is the movie starting?
let hasTicket = true;
let movieStarting = true;
console.log(hasTicket && movieStarting); // true

// Is the game over AND did you get a high score?
let gameOver = true;
let highScore = false;
console.log(gameOver && highScore); // false

Instructions

▼ ← Click the triangle to hide or reveal instructions.

JavaScript Code Editor

Task Incomplete

Editor Input:

Loading...

Editor Output:

Click "Run Code" to see the output here
  • The && symbol is like a checklist where every single box must be checked "Yes."
  • If you have two things to check and one of them is false, the computer gives up and says "false."
  • It is perfect for rules, like saying you need to be the right age AND have enough money to buy a toy.
  • Think of it like a "Both or Nothing" rule—it only says true when both sides match perfectly.

Code Example

cold = true;
snowing = false;
console.log(raining || warm); // true

// Do you have a coupon OR is it a free-cookie day?
let hasCoupon = true;
let freeDay = false;
console.log(hasCoupon || freeDay); // true

// Is it the weekend OR are you on summer break?
let isWeekend = false;
let isSummer = false;
console.log(isWeekend || isSummer); // false

Instructions

▼ ← Click the triangle to hide or reveal instructions.

JavaScript Code Editor

Task Incomplete

Editor Input:

Loading...

Editor Output:

Click "Run Code" to see the output here
  • The || symbol is like a "One or the Other" rule; the computer is happy if just one side is true.
  • It only says false if both sides are wrong at the same time, like having no weekend and no summer break.
  • You can use this to let a player win if they find the gold key OR if they find the secret back door.
  • Think of it like a "Pick Your Way" path—as long as one path is open, you can keep going!

Code Example

cold = true;
snowing = false;
console.log(!cold); // false
console.log(!snowing); //true

// If the game is NOT over, keep playing!
let gameOver = false;
console.log(!gameOver); // true

// If the light is NOT on, it must be dark.
let lightOn = true;
console.log(!lightOn); // false

Instructions

▼ ← Click the triangle to hide or reveal instructions.

JavaScript Code Editor

Task Incomplete

Editor Input:

Loading...

Editor Output:

Click "Run Code" to see the output here
  • The ! symbol is like a "Reverse Button" that flips a value to its exact opposite.
  • It turns false into true and turns true into false.
  • You can use it to check if a player is NOT out of health or if a door is NOT locked.
  • Think of it like playing "Opposite Day"—whatever you tell the computer, it believes the other way!
Lesson Progress: 0%
Boolean Operators
Lesson Incomplete
← Previous: Operators
Lesson 5 of 16
Next: Conditions - if →