Data Types: Booleans

Objective

Students must use boolean values to track state flags and control game flow.

Evidence

Boolean state flags in game components:

  • Ghost.js - State management booleans
  • DeathBarrier.js - Collision and activation flags
  • Multiple classes - isJumping, isPaused, isVulnerable flags

Implementation Details

  • Boolean primitives: true and false
  • Boolean flags for state tracking
  • Conditional expressions returning booleans
  • Negation operator (!) to flip boolean values
  • Boolean logic in game decisions

Key Concepts

  • Boolean data type (true/false)
  • Truthy and falsy values in JavaScript
  • Boolean operators (&&,   , !)
  • Boolean methods (.toString(), valueOf())
  • Conditional (ternary) operator for boolean expressions