Day:10- JS Conditional Decisions!

Conditional statements allow your program to act like a decision tree. Instead of running every line of code blindly from top to bottom, our JavaScript code can ask questions, evaluate whether conditions are true or false, and choose different execution paths.

Conditional Decision is a structure that controls code execution based on specific logic checks.

Structuring Code Logic

Summary

♦ Keyword: if

Purpose: Starts the decision chain

Requires Condition? Yes, if (condition)

When does it execute? When the condition is true.

♦ Keyword: else if

Purpose: Tests alternative conditions

Requires Condition? Yes, else if (condition)

When does it execute? When previous checks were false AND its condition is true.