Coding task · JavaScript and TypeScript course · Module 1: JavaScript Basics

Practice: Comparison and Logical Operators

In the Jurassic Park security system, you need to check multiple conditions simultaneously. Use comparison operators (===, !==, >, <) and logical operators (&&, ||, !) to build an enclosure status verification system.

Task

You have enclosure data: const voltage = 8500 and const fenceHealth = 40. Create a variable isSafe that is true when voltage > 5000 and at the same time fenceHealth > 50 (use &&), and a variable needsAttention that is true when fenceHealth < 50 or voltage === 0 (use ||). Display both in the console.