This exercise is designed to help you practice writing conditional statements using if, else if, and else in JavaScript. Conditional logic is an essential part of programming as it allows you to control the flow of your code based on different conditions.
By completing these drills, you will:
- Write basic condition checks using
ifstatements. - Use
elseandelse ifto handle multiple conditions. - Work with comparisons, logical operators, and different scenarios.
- Test and debug your code to ensure it produces the correct output.
-
Set up your environment:
- Fork & Clone this repo. Starter code and prompts are in
conditionals.js). - Use Node.js to run the file in your terminal (
node conditionals.js).
- Fork & Clone this repo. Starter code and prompts are in
-
Follow the prompts:
- Each drill has a description and a variable setup provided for you.
- Use
if,else if, andelseto implement the logic needed to meet the requirements.
-
Test your code:
- Run your program with the provided inputs.
- Modify the variables to test additional scenarios and ensure your code works for edge cases.
-
Code formatting:
- Use clean and consistent formatting (proper indentation and comments).
- Add comments to explain your logic if needed.
-
Submission:
- Complete all drills in the file.
- Push your work your forked copy, create a pull request on the original repo, and then submit your URL on Google Classroom.
- Be prepared to explain how your code works.
Happy coding and good luck! 🚀