The Logic Inverter

Easy+15 XP

Mission Briefing

The logic gates to the inner sanctum are inverted. A true key opens a false door. You must build an inverter circuit to safely pass through.

The Concept: Boolean Inversion

The ! (Logical NOT) operator is a flipper. It takes a boolean value (true or false) and immediately reverses it. If it was true, it becomes false, and vice versa.

The Objective

Your function receives a boolean parameter named state.

  1. Invert the boolean value of state.
  2. Return the exact opposite of the original state.

01EXAMPLE 1

Inputstate = true
Outputfalse

Constraints

  • Use the ! operator.
FundamentalsBooleans
JavaScript
Loading...
3 Hidden

Input Arguments

statetrue

Expected Output

false

Click RUN to test your solution