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

Practice: if-else Conditions

Implement a park safety status monitoring system. The system should check various conditions and display appropriate messages.

Task

Store the dinosaur's distance from the fence in metres in a variable dinoDistance (e.g. 5). Using if / else if / else, display in the console: 'RED ALERT' when the distance is less than 3, 'WARNING' when it is less than 10, and 'SAFE' otherwise.